Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Litellm proxy related error handling #491

Merged
merged 193 commits into from
Mar 7, 2025
Merged

Conversation

lickem22
Copy link
Contributor

@lickem22 lickem22 commented Feb 28, 2025

Reviewer: @poornimaramesh
Estimate: 20 mins


Ticket

Fixes: AAQ-896

Description

Goal

The goal of this PR is to improve error handling, so we don't show 500 errors when there are LiteLLM related errors

Changes

The following changes have been made:

  • Created two Custom errors LLMCallException, EmbeddingCallException.
  • Updated contents and question_answers routers to raise a 503 error when these exceptions are caught.
  • Quick frontend fixes

Future Tasks (optional)

How has this been tested?

To-do before merge (optional)

Checklist

Fill with x for completed.

  • My code follows the style guidelines of this project
  • I have reviewed my own code to ensure good quality
  • I have tested the functionality of my code to ensure it works as intended
  • I have resolved merge conflicts

tonyzhao6 added 30 commits January 10, 2025 14:56
…Added /chat endpoint. Temporariliy commented out /search endpoint for quick testing.
@lickem22 lickem22 marked this pull request as ready for review March 3, 2025 08:08
@poornimaramesh
Copy link
Collaborator

Tested and works well thanks!

I did spot another unrelated error though: every time I try to put in a string tag in the content card it errored out with the following error.

sqlalchemy.exc.ProgrammingError: (sqlalchemy.dialects.postgresql.asyncpg.ProgrammingError) <class 'asyncpg.exceptions.UndefinedFunctionError'>: operator does not exist: integer = character varying
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
[SQL: SELECT tag.created_datetime_utc, tag.tag_id, tag.tag_name, tag.updated_datetime_utc, tag.workspace_id 
FROM tag 
WHERE tag.workspace_id = $1::INTEGER AND tag.tag_id IN ($2::VARCHAR)]
[parameters: (1, 'string')]
(Background on this error at: https://sqlalche.me/e/20/f405)

I think it's happening because the pydantic class ContentCreate seems to take lists of strings for content tags, but validate_tags needs the tags to be integers.

@lickem22
Copy link
Contributor Author

lickem22 commented Mar 7, 2025

Tested and works well thanks!

I did spot another unrelated error though: every time I try to put in a string tag in the content card it errored out with the following error.

sqlalchemy.exc.ProgrammingError: (sqlalchemy.dialects.postgresql.asyncpg.ProgrammingError) <class 'asyncpg.exceptions.UndefinedFunctionError'>: operator does not exist: integer = character varying
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
[SQL: SELECT tag.created_datetime_utc, tag.tag_id, tag.tag_name, tag.updated_datetime_utc, tag.workspace_id 
FROM tag 
WHERE tag.workspace_id = $1::INTEGER AND tag.tag_id IN ($2::VARCHAR)]
[parameters: (1, 'string')]
(Background on this error at: https://sqlalche.me/e/20/f405)

I think it's happening because the pydantic class ContentCreate seems to take lists of strings for content tags, but validate_tags needs the tags to be integers.

Hi @poornimaramesh,

Thanks for catching that. But I am struggling to recreate that error on my end. If you don't mind I will merge this and we can huddle on that later

@lickem22 lickem22 merged commit 8dad481 into main Mar 7, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants