Skip to content

Return detailed error output from Gemini API calls. #510

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

mkbehr
Copy link
Collaborator

@mkbehr mkbehr commented May 9, 2025

Restructure the ModelResponse interface to return error information.

  • A new status field contains an enum to indicate whether the response was OK.
  • text is populated only if the model returned a text response. (It will be empty for most error cases, but some errors will leave some text populated, like running out of output tokens.)
  • A new errorMessage field contains the error message.
  • A new parsedResponse field isn't populated yet, but it'll let us move structured output parsing closer to the model call, and return a parsing error if the model returns badly-formatted data.

Errors are reported through the prompt testing endpoint, but otherwise not used yet.

Only the Gemini API is fully supported so far. The OpenAI/compatible API will report UNKNOWN_ERROR for some errors, and the Ollama API will always report OK.

  • Tests pass

@mkbehr mkbehr requested a review from vivtsai May 9, 2025 22:07
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.

1 participant