fix issue with tool calling use gemini 3.0 by including throught signature from extra content
This commit is contained in:
parent
13e4028d42
commit
cf39191359
4 changed files with 47 additions and 16 deletions
|
|
@ -622,8 +622,9 @@ func (al *AgentLoop) runLLMIteration(ctx context.Context, messages []providers.M
|
|||
for _, tc := range response.ToolCalls {
|
||||
argumentsJSON, _ := json.Marshal(tc.Arguments)
|
||||
assistantMsg.ToolCalls = append(assistantMsg.ToolCalls, providers.ToolCall{
|
||||
ID: tc.ID,
|
||||
Type: "function",
|
||||
ID: tc.ID,
|
||||
Type: "function",
|
||||
ExtraContent: tc.ExtraContent,
|
||||
Function: &providers.FunctionCall{
|
||||
Name: tc.Name,
|
||||
Arguments: string(argumentsJSON),
|
||||
|
|
|
|||
|
|
@ -129,8 +129,13 @@ func (p *HTTPProvider) parseResponse(body []byte) (*LLMResponse, error) {
|
|||
Message struct {
|
||||
Content string `json:"content"`
|
||||
ToolCalls []struct {
|
||||
ID string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
ID string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
ExtraContent struct {
|
||||
Google struct {
|
||||
ThoughtSignature string `json:"thought_signature,omitempty"`
|
||||
} `json:"google,omitempty"`
|
||||
} `json:"extra_content,omitempty"`
|
||||
Function *struct {
|
||||
Name string `json:"name"`
|
||||
Arguments string `json:"arguments"`
|
||||
|
|
@ -179,7 +184,12 @@ func (p *HTTPProvider) parseResponse(body []byte) (*LLMResponse, error) {
|
|||
}
|
||||
|
||||
toolCalls = append(toolCalls, ToolCall{
|
||||
ID: tc.ID,
|
||||
ID: tc.ID,
|
||||
ExtraContent: ExtraContent{
|
||||
Google: GoogleExtraContent{
|
||||
ThoughtSignature: tc.ExtraContent.Google.ThoughtSignature,
|
||||
},
|
||||
},
|
||||
Name: name,
|
||||
Arguments: arguments,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,13 +1,24 @@
|
|||
package providers
|
||||
|
||||
import "context"
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
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"`
|
||||
ExtraContent ExtraContent `json:"extra_content,omitempty"`
|
||||
Function *FunctionCall `json:"function,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Arguments map[string]interface{} `json:"arguments,omitempty"`
|
||||
}
|
||||
|
||||
type ExtraContent struct {
|
||||
Google GoogleExtraContent `json:"google,omitempty"`
|
||||
}
|
||||
|
||||
type GoogleExtraContent struct {
|
||||
ThoughtSignature string `json:"thought_signature,omitempty"`
|
||||
}
|
||||
|
||||
type FunctionCall struct {
|
||||
|
|
|
|||
|
|
@ -10,11 +10,20 @@ type Message struct {
|
|||
}
|
||||
|
||||
type ToolCall struct {
|
||||
ID string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
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"`
|
||||
ExtraContent ExtraContent `json:"extra_content,omitempty"`
|
||||
Function *FunctionCall `json:"function,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Arguments map[string]interface{} `json:"arguments,omitempty"`
|
||||
}
|
||||
|
||||
type ExtraContent struct {
|
||||
Google GoogleExtraContent `json:"google,omitempty"`
|
||||
}
|
||||
|
||||
type GoogleExtraContent struct {
|
||||
ThoughtSignature string `json:"thought_signature,omitempty"`
|
||||
}
|
||||
|
||||
type FunctionCall struct {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue