litellm
litellm copied to clipboard
fix(gemini): append empty choice to model response when there are no …
Title
make sure response has at least one choice
Relevant issues
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
- [x] My PR's scope is as isolated as possible, it only solves 1 specific problem
Type
🐛 Bug Fix
Changes
gemini-2.5-pro-preview-03-25 at some cases will respond with a non-error message that has neither candidates nor promptFeedback, like this:
{
"usageMetadata": {
"promptTokenCount": 9291,
"totalTokenCount": 9291,
"promptTokensDetails": [
{
"modality": "TEXT",
"tokenCount": 9291
}
]
},
"modelVersion": "gemini-2.5-pro-preview-03-25"
}
this breaks apps like smolagents, this is a related issue on smolagents.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| litellm | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Apr 22, 2025 7:40am |
Hey @sonald can you add a unit test for this change in here
@krrishdholakia I have added the test
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.