diff --git a/pkg/agent/loop.go b/pkg/agent/loop.go index 0f1b26c5c..83bc97320 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -603,7 +603,8 @@ func (al *AgentLoop) runLLMIteration(ctx context.Context, agent *AgentInstance, Name: tc.Name, Arguments: string(argumentsJSON), }, - Name: tc.Name, + Name: tc.Name, + ExtraContent: tc.ExtraContent, }) } messages = append(messages, assistantMsg) diff --git a/pkg/providers/openai_compat/provider.go b/pkg/providers/openai_compat/provider.go index 73fac3435..7552e6a96 100644 --- a/pkg/providers/openai_compat/provider.go +++ b/pkg/providers/openai_compat/provider.go @@ -133,6 +133,11 @@ func parseResponse(body []byte) (*LLMResponse, error) { Name string `json:"name"` Arguments string `json:"arguments"` } `json:"function"` + ExtraContent *struct { + Google *struct { + ThoughtSignature string `json:"thought_signature"` + } `json:"google"` + } `json:"extra_content"` } `json:"tool_calls"` } `json:"message"` FinishReason string `json:"finish_reason"` @@ -167,10 +172,20 @@ func parseResponse(body []byte) (*LLMResponse, error) { } } + var extra *protocoltypes.ToolCallExtraContent + if tc.ExtraContent != nil && tc.ExtraContent.Google != nil { + extra = &protocoltypes.ToolCallExtraContent{ + Google: &protocoltypes.GoogleExtraContent{ + ThoughtSignature: tc.ExtraContent.Google.ThoughtSignature, + }, + } + } + toolCalls = append(toolCalls, ToolCall{ - ID: tc.ID, - Name: name, - Arguments: arguments, + ID: tc.ID, + Name: name, + Arguments: arguments, + ExtraContent: extra, }) } diff --git a/pkg/providers/protocoltypes/types.go b/pkg/providers/protocoltypes/types.go index 6b33ae734..2daf93660 100644 --- a/pkg/providers/protocoltypes/types.go +++ b/pkg/providers/protocoltypes/types.go @@ -1,11 +1,20 @@ package protocoltypes type ToolCall struct { - ID string `json:"id"` - Type string `json:"type,omitempty"` - Function *FunctionCall `json:"function,omitempty"` - Name string `json:"name,omitempty"` - Arguments map[string]interface{} `json:"arguments,omitempty"` + ID string `json:"id"` + Type string `json:"type,omitempty"` + Function *FunctionCall `json:"function,omitempty"` + Name string `json:"name,omitempty"` + Arguments map[string]interface{} `json:"arguments,omitempty"` + ExtraContent *ToolCallExtraContent `json:"extra_content,omitempty"` +} + +type ToolCallExtraContent struct { + Google *GoogleExtraContent `json:"google,omitempty"` +} + +type GoogleExtraContent struct { + ThoughtSignature string `json:"thought_signature,omitempty"` } type FunctionCall struct {