fix(gemini): preserve thought_signature in tool calls to prevent 400 errors

This commit is contained in:
mrbeandev committed 2026-02-17 20:04:45 +05:30
1 parent 920e30a241
commit 33915fb712
3 files changed
+24 -17

No files matched your search

+8 -2
View File
@@ -624,12 +624,18 @@ func (al *AgentLoop) runLLMIteration(ctx context.Context, messages []providers.M
}
for _, tc := range response.ToolCalls {
argumentsJSON, _ := json.Marshal(tc.Arguments)
thoughtSignature := ""
if tc.Function != nil {
thoughtSignature = tc.Function.ThoughtSignature
}
assistantMsg.ToolCalls = append(assistantMsg.ToolCalls, providers.ToolCall{
ID: tc.ID,
Type: "function",
Function: &providers.FunctionCall{
Name: tc.Name,
Arguments: string(argumentsJSON),
Name: tc.Name,
Arguments: string(argumentsJSON),
ThoughtSignature: thoughtSignature,
},
})
}