mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-29 01:42:19 +00:00
This commit implements a complete, end-to-end fix for the native Gemini API translation feature, allowing requests to be correctly routed to other model providers via `model_group_alias`. The original implementation was broken, causing `systemInstruction` and `tools` to be dropped from requests. This was resolved by refactoring the Gemini endpoint to use a dedicated translation path, similar to the Anthropic adapter. Additionally, this commit hardens the streaming response adapter to correctly handle tool calls generated by the newly-fixed request path. Key improvements to the response handling include: - Replaced the fragile `id`-based tool call tracking with a robust `index`-based accumulation logic. - Fixed a memory leak and improved logging in the stream finalization process. - Prevented empty, non-compliant chunks from being sent to the client during tool call streaming. - Optimized the accumulator to skip and log superfluous empty chunks sent by some models. |
||
|---|---|---|
| .. | ||
| endpoints.py | ||