Skip to content

Commit

Permalink
refactor (backend): ensure that application_id is passed through to i…
Browse files Browse the repository at this point in the history
…nvoke llm from the backend when running evaluations
  • Loading branch information
aybruhm committed Jan 31, 2025
1 parent 06ad0a6 commit a1e1662
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions agenta-backend/agenta_backend/services/llm_apps_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ async def invoke_app(
openapi_parameters: List[Dict],
user_id: str,
project_id: str,
**kwargs,
) -> InvokationResult:
"""
Invokes an app for one datapoint using the openapi_parameters to determine
Expand All @@ -215,7 +216,11 @@ async def invoke_app(
Raises:
aiohttp.ClientError: If the POST request fails.
"""

url = f"{uri}/generate"
if "application_id" in kwargs:
url = url + f"?application_id={kwargs.get('application_id')}"

payload = await make_payload(datapoint, parameters, openapi_parameters)

headers = None
Expand Down Expand Up @@ -301,6 +306,7 @@ async def run_with_retry(
openapi_parameters: List[Dict],
user_id: str,
project_id: str,
**kwargs,
) -> InvokationResult:
"""
Runs the specified app with retry mechanism.
Expand Down Expand Up @@ -329,6 +335,7 @@ async def run_with_retry(
openapi_parameters,
user_id,
project_id,
**kwargs,
)
return result
except aiohttp.ClientError as e:
Expand Down Expand Up @@ -368,6 +375,7 @@ async def batch_invoke(
rate_limit_config: Dict,
user_id: str,
project_id: str,
**kwargs,
) -> List[InvokationResult]:
"""
Invokes the LLm apps in batches, processing the testset data.
Expand Down Expand Up @@ -424,6 +432,7 @@ async def run_batch(start_idx: int):
openapi_parameters,
user_id,
project_id,
**kwargs,
)
)
tasks.append(task)
Expand Down
3 changes: 3 additions & 0 deletions agenta-backend/agenta_backend/tasks/evaluations.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ def evaluate(
rate_limit_config,
user_id,
project_id,
application_id=str(
app.id
), #! NOTE: removing this will break observability
)
)

Expand Down

0 comments on commit a1e1662

Please sign in to comment.