Commit f6644b5
committed
fix: preserve Gemini thought_signature in multi-turn tool calls
When using Gemini models with thinking/reasoning enabled through the
AI SDK integration, the thought_signature was not preserved across
multi-turn conversations with tool calls.
The issue was that providerData was using result.providerMetadata
(overall response metadata) instead of toolCall.providerMetadata
(per-tool-call metadata containing thoughtSignature).
Changes:
- Non-streaming mode: Prioritize toolCall.providerMetadata over
result.providerMetadata for function_call outputs
- Streaming mode: Capture part.providerMetadata and include it
as providerData in function_call outputs
Reference: https://ai.google.dev/gemini-api/docs/thought-signatures
Related: openai/openai-agents-python#21371 parent d552b50 commit f6644b5
1 file changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
711 | 711 | | |
712 | 712 | | |
713 | 713 | | |
714 | | - | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
715 | 717 | | |
716 | 718 | | |
717 | 719 | | |
| |||
916 | 918 | | |
917 | 919 | | |
918 | 920 | | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
919 | 924 | | |
920 | 925 | | |
921 | 926 | | |
| |||
0 commit comments