- Notifications
You must be signed in to change notification settings - Fork746
Normalize finish_reason to tool_call for Gemini/Vertex AI when tool calls are present#5076
-
ProblemWhen using Gemini/Vertex AI models with function calling, the API returns This inconsistency makes it difficult to build provider-agnostic tool execution loops, as the logic typically relies on Current behavior (Gemini){"variant_name":"gemini-2.5-pro","content": [ {"type":"tool_call","id":"0","raw_name":"get_weather","raw_arguments":"{\"location\":\"London\"}" } ],"finish_reason":"stop"}Gemini returns Expected behavior (OpenAI/Anthropic){"content": [...tool_call...],"finish_reason":"tool_call"}Other providers return Proposed solutionAdd an option (opt-in or opt-out) to normalize
This would provide consistent behavior across all providers and simplify downstream tool execution logic. WorkaroundCurrently, we iterate over the References
|
BetaWas this translation helpful?Give feedback.
All reactions
👀 1