Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/utils/agents/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,11 @@ def map_pydantic_agent_run_error(
match exc:
case ContentFilterError() as filter_exc:
return InternalServerErrorResponse.query_failed(str(filter_exc))
case IncompleteToolCall() | UnexpectedModelBehavior():
case IncompleteToolCall():
return PromptTooLongResponse(model=model_id)
case UnexpectedModelBehavior():
logger.error("Unexpected model behavior: %s", exc, exc_info=True)
return InternalServerErrorResponse.generic()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes looks good to me but I would first squash the commits into a single commit for this small change.

case UsageLimitExceeded():
return QuotaExceededResponse.model(model_id)
case ModelHTTPError() as http_exc if is_context_length_error(str(http_exc)):
Expand Down
Loading