Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pkg/agent/loop.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
16 changes: 13 additions & 3 deletions pkg/providers/http_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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,
})
Expand Down
23 changes: 17 additions & 6 deletions pkg/providers/types.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
19 changes: 14 additions & 5 deletions pkg/tools/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down