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 {
|
for _, tc := range response.ToolCalls {
|
||||||
argumentsJSON, _ := json.Marshal(tc.Arguments)
|
argumentsJSON, _ := json.Marshal(tc.Arguments)
|
||||||
assistantMsg.ToolCalls = append(assistantMsg.ToolCalls, providers.ToolCall{
|
assistantMsg.ToolCalls = append(assistantMsg.ToolCalls, providers.ToolCall{
|
||||||
ID: tc.ID,
|
ID: tc.ID,
|
||||||
Type: "function",
|
Type: "function",
|
||||||
|
ExtraContent: tc.ExtraContent,
|
||||||
Function: &providers.FunctionCall{
|
Function: &providers.FunctionCall{
|
||||||
Name: tc.Name,
|
Name: tc.Name,
|
||||||
Arguments: string(argumentsJSON),
|
Arguments: string(argumentsJSON),
|
||||||
|
|
|
||||||
|
|
@ -129,8 +129,13 @@ func (p *HTTPProvider) parseResponse(body []byte) (*LLMResponse, error) {
|
||||||
Message struct {
|
Message struct {
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
ToolCalls []struct {
|
ToolCalls []struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
|
ExtraContent struct {
|
||||||
|
Google struct {
|
||||||
|
ThoughtSignature string `json:"thought_signature,omitempty"`
|
||||||
|
} `json:"google,omitempty"`
|
||||||
|
} `json:"extra_content,omitempty"`
|
||||||
Function *struct {
|
Function *struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Arguments string `json:"arguments"`
|
Arguments string `json:"arguments"`
|
||||||
|
|
@ -179,7 +184,12 @@ func (p *HTTPProvider) parseResponse(body []byte) (*LLMResponse, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
toolCalls = append(toolCalls, ToolCall{
|
toolCalls = append(toolCalls, ToolCall{
|
||||||
ID: tc.ID,
|
ID: tc.ID,
|
||||||
|
ExtraContent: ExtraContent{
|
||||||
|
Google: GoogleExtraContent{
|
||||||
|
ThoughtSignature: tc.ExtraContent.Google.ThoughtSignature,
|
||||||
|
},
|
||||||
|
},
|
||||||
Name: name,
|
Name: name,
|
||||||
Arguments: arguments,
|
Arguments: arguments,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,24 @@
|
||||||
package providers
|
package providers
|
||||||
|
|
||||||
import "context"
|
import (
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
type ToolCall struct {
|
type ToolCall struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Type string `json:"type,omitempty"`
|
Type string `json:"type,omitempty"`
|
||||||
Function *FunctionCall `json:"function,omitempty"`
|
ExtraContent ExtraContent `json:"extra_content,omitempty"`
|
||||||
Name string `json:"name,omitempty"`
|
Function *FunctionCall `json:"function,omitempty"`
|
||||||
Arguments map[string]interface{} `json:"arguments,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 {
|
type FunctionCall struct {
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,20 @@ type Message struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ToolCall struct {
|
type ToolCall struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Function *FunctionCall `json:"function,omitempty"`
|
ExtraContent ExtraContent `json:"extra_content,omitempty"`
|
||||||
Name string `json:"name,omitempty"`
|
Function *FunctionCall `json:"function,omitempty"`
|
||||||
Arguments map[string]interface{} `json:"arguments,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 {
|
type FunctionCall struct {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue