Skip to content
Merged
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
24 changes: 12 additions & 12 deletions cmd/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ func (s *AgentSession) buildSDKMessages() []sdk.Message {
}

if msg.ToolCallID != "" {
sdkMsg.ToolCallId = &msg.ToolCallID
sdkMsg.ToolCallID = &msg.ToolCallID
}

messages = append(messages, sdkMsg)
Expand Down Expand Up @@ -635,7 +635,7 @@ func (s *AgentSession) executeToolCallsParallel(toolCalls []sdk.ChatCompletionMe
results[index] = ConversationMessage{
Role: "tool",
Content: fmt.Sprintf("Tool execution failed: %s", err.Error()),
ToolCallID: tc.Id,
ToolCallID: tc.ID,
ToolExecution: errorResult,
Timestamp: time.Now(),
}
Expand All @@ -645,7 +645,7 @@ func (s *AgentSession) executeToolCallsParallel(toolCalls []sdk.ChatCompletionMe
results[index] = ConversationMessage{
Role: "tool",
Content: s.formatToolResult(result),
ToolCallID: tc.Id,
ToolCallID: tc.ID,
ToolExecution: result,
Timestamp: time.Now(),
}
Expand Down Expand Up @@ -718,7 +718,7 @@ func (s *AgentSession) executeToolCallsWithApproval(toolCalls []sdk.ChatCompleti
results[idx] = ConversationMessage{
Role: "tool",
Content: fmt.Sprintf("Tool execution failed: %s", err.Error()),
ToolCallID: tc.Id,
ToolCallID: tc.ID,
ToolExecution: &domain.ToolExecutionResult{
ToolName: tc.Function.Name,
Success: false,
Expand All @@ -731,7 +731,7 @@ func (s *AgentSession) executeToolCallsWithApproval(toolCalls []sdk.ChatCompleti
results[idx] = ConversationMessage{
Role: "tool",
Content: s.formatToolResult(result),
ToolCallID: tc.Id,
ToolCallID: tc.ID,
ToolExecution: result,
Timestamp: time.Now(),
}
Expand All @@ -757,7 +757,7 @@ func (s *AgentSession) executeToolCallsWithApproval(toolCalls []sdk.ChatCompleti
results[ic.index] = ConversationMessage{
Role: "tool",
Content: fmt.Sprintf("Tool '%s' was rejected by the user.", tc.Function.Name),
ToolCallID: tc.Id,
ToolCallID: tc.ID,
ToolExecution: &domain.ToolExecutionResult{
ToolName: tc.Function.Name,
Success: false,
Expand All @@ -774,7 +774,7 @@ func (s *AgentSession) executeToolCallsWithApproval(toolCalls []sdk.ChatCompleti
results[ic.index] = ConversationMessage{
Role: "tool",
Content: fmt.Sprintf("Tool execution failed: %s", err.Error()),
ToolCallID: tc.Id,
ToolCallID: tc.ID,
ToolExecution: &domain.ToolExecutionResult{
ToolName: tc.Function.Name,
Success: false,
Expand All @@ -787,7 +787,7 @@ func (s *AgentSession) executeToolCallsWithApproval(toolCalls []sdk.ChatCompleti
results[ic.index] = ConversationMessage{
Role: "tool",
Content: s.formatToolResult(result),
ToolCallID: tc.Id,
ToolCallID: tc.ID,
ToolExecution: result,
Timestamp: time.Now(),
}
Expand Down Expand Up @@ -839,7 +839,7 @@ func (s *AgentSession) outputApprovalRequest(tc sdk.ChatCompletionMessageToolCal
Type: "approval_request",
ToolName: tc.Function.Name,
ToolArgs: tc.Function.Arguments,
ToolCallID: tc.Id,
ToolCallID: tc.ID,
}
output, err := json.Marshal(req)
if err != nil {
Expand Down Expand Up @@ -883,7 +883,7 @@ func (s *AgentSession) convertToConversationEntry(msg ConversationMessage) domai
}

if msg.ToolCallID != "" {
sdkMsg.ToolCallId = &msg.ToolCallID
sdkMsg.ToolCallID = &msg.ToolCallID
}

entry := domain.ConversationEntry{
Expand Down Expand Up @@ -926,8 +926,8 @@ func (s *AgentSession) convertFromConversationEntry(entry domain.ConversationEnt
msg.ToolCalls = entry.Message.ToolCalls
}

if entry.Message.ToolCallId != nil {
msg.ToolCallID = *entry.Message.ToolCallId
if entry.Message.ToolCallID != nil {
msg.ToolCallID = *entry.Message.ToolCallID
}

if entry.ToolExecution != nil {
Expand Down
26 changes: 13 additions & 13 deletions cmd/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func TestExecuteToolCallsParallel(t *testing.T) {
name: "single tool call",
toolCalls: []sdk.ChatCompletionMessageToolCall{
{
Id: "call_1",
ID: "call_1",
Function: sdk.ChatCompletionMessageToolCallFunction{
Name: "Read",
Arguments: `{"file_path": "test.txt"}`,
Expand All @@ -267,21 +267,21 @@ func TestExecuteToolCallsParallel(t *testing.T) {
name: "multiple tool calls",
toolCalls: []sdk.ChatCompletionMessageToolCall{
{
Id: "call_1",
ID: "call_1",
Function: sdk.ChatCompletionMessageToolCallFunction{
Name: "Read",
Arguments: `{"file_path": "test1.txt"}`,
},
},
{
Id: "call_2",
ID: "call_2",
Function: sdk.ChatCompletionMessageToolCallFunction{
Name: "Grep",
Arguments: `{"pattern": "func"}`,
},
},
{
Id: "call_3",
ID: "call_3",
Function: sdk.ChatCompletionMessageToolCallFunction{
Name: "Write",
Arguments: `{"file_path": "output.txt", "content": "hello"}`,
Expand All @@ -302,7 +302,7 @@ func TestExecuteToolCallsParallel(t *testing.T) {
name: "tool call with error",
toolCalls: []sdk.ChatCompletionMessageToolCall{
{
Id: "call_1",
ID: "call_1",
Function: sdk.ChatCompletionMessageToolCallFunction{
Name: "Read",
Arguments: `{"file_path": "nonexistent.txt"}`,
Expand Down Expand Up @@ -388,14 +388,14 @@ func TestProcessSyncResponseParallel(t *testing.T) {
Content: "I'll help you with that.",
ToolCalls: []sdk.ChatCompletionMessageToolCall{
{
Id: "call_1",
ID: "call_1",
Function: sdk.ChatCompletionMessageToolCallFunction{
Name: "Read",
Arguments: `{"file_path": "test.txt"}`,
},
},
{
Id: "call_2",
ID: "call_2",
Function: sdk.ChatCompletionMessageToolCallFunction{
Name: "Grep",
Arguments: `{"pattern": "test"}`,
Expand Down Expand Up @@ -581,7 +581,7 @@ func getAssistantMessageWithToolCallsTestCase() struct {
Content: sdk.NewMessageContent(""),
ToolCalls: &[]sdk.ChatCompletionMessageToolCall{
{
Id: "call_1",
ID: "call_1",
Function: sdk.ChatCompletionMessageToolCallFunction{
Name: "Read",
Arguments: `{"file_path":"test.txt"}`,
Expand All @@ -598,7 +598,7 @@ func getAssistantMessageWithToolCallsTestCase() struct {
Timestamp: mockTime(),
ToolCalls: &[]sdk.ChatCompletionMessageToolCall{
{
Id: "call_1",
ID: "call_1",
Function: sdk.ChatCompletionMessageToolCallFunction{
Name: "Read",
Arguments: `{"file_path":"test.txt"}`,
Expand All @@ -624,7 +624,7 @@ func getToolResponseWithToolCallIDTestCase() struct {
Message: sdk.Message{
Role: sdk.Tool,
Content: sdk.NewMessageContent("File content here"),
ToolCallId: stringPtr("call_1"),
ToolCallID: stringPtr("call_1"),
},
Model: "openai/gpt-4",
Time: mockTime(),
Expand Down Expand Up @@ -723,7 +723,7 @@ func getMessageWithToolExecutionMetadataTestCase() struct {
Message: sdk.Message{
Role: sdk.Tool,
Content: sdk.NewMessageContent("Result data"),
ToolCallId: stringPtr("call_2"),
ToolCallID: stringPtr("call_2"),
},
Model: "openai/gpt-4",
Time: mockTime(),
Expand Down Expand Up @@ -793,7 +793,7 @@ func TestReasoningContentRoundTripSyncPath(t *testing.T) {
Content: "",
ReasoningContent: reasoning,
ToolCalls: []sdk.ChatCompletionMessageToolCall{{
Id: "call_1",
ID: "call_1",
Function: sdk.ChatCompletionMessageToolCallFunction{
Name: "Bash",
Arguments: `{"command":"echo hi"}`,
Expand Down Expand Up @@ -826,7 +826,7 @@ func TestReasoningContentRoundTripSyncPath(t *testing.T) {
Content: "",
ReasoningContent: reasoning,
ToolCalls: &[]sdk.ChatCompletionMessageToolCall{{
Id: "call_1",
ID: "call_1",
Function: sdk.ChatCompletionMessageToolCallFunction{
Name: "Bash", Arguments: `{"command":"echo hi"}`,
},
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.3
github.com/inference-gateway/adk v0.17.3
github.com/inference-gateway/sdk v1.16.2
github.com/inference-gateway/sdk v1.16.3
github.com/ledongthuc/pdf v0.0.0-20250511090121-5959a4027728
github.com/lib/pq v1.12.3
github.com/metoro-io/mcp-golang v0.16.1
Expand Down Expand Up @@ -68,7 +68,7 @@ require (
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/gen2brain/shm v0.2.1 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-resty/resty/v2 v2.16.5 // indirect
github.com/go-resty/resty/v2 v2.17.2 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/godbus/dbus/v5 v5.2.2 // indirect
github.com/gorilla/css v1.0.1 // indirect
Expand All @@ -91,7 +91,7 @@ require (
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/termenv v0.16.0 // indirect
github.com/ncruces/go-strftime v1.0.0 // indirect
github.com/oapi-codegen/runtime v1.1.2 // indirect
github.com/oapi-codegen/runtime v1.4.0 // indirect
github.com/otiai10/gosseract/v2 v2.4.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ github.com/go-playground/validator/v10 v10.24.0 h1:KHQckvo8G6hlWnrPX4NJJ+aBfWNAE
github.com/go-playground/validator/v10 v10.24.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus=
github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM=
github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA=
github.com/go-resty/resty/v2 v2.17.2 h1:FQW5oHYcIlkCNrMD2lloGScxcHJ0gkjshV3qcQAyHQk=
github.com/go-resty/resty/v2 v2.17.2/go.mod h1:kCKZ3wWmwJaNc7S29BRtUhJwy7iqmn+2mLtQrOyQlVA=
github.com/go-telegram/bot v1.20.0 h1:4Pea/qTidSspr4WBJw9FbHUMNhYeqszBqQUfsQEyFbc=
github.com/go-telegram/bot v1.20.0/go.mod h1:i2TRs7fXWIeaceF3z7KzsMt/he0TwkVC680mvdTFYeM=
github.com/go-vgo/robotgo v1.0.2 h1:MbhSoJSzv/PNr2dL6H0Z1IUL4Uypsk2b9lQsGQ15hjU=
Expand Down Expand Up @@ -137,8 +137,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/inference-gateway/adk v0.17.3 h1:ZZpJBoCn+KbBPnWUUQwp9SFW7fCfsrMWMa0K62VjjN4=
github.com/inference-gateway/adk v0.17.3/go.mod h1:UbWW5qTu/VzF3mnGTSOJgbyAy6Rz08GH+zI6zhDQUEs=
github.com/inference-gateway/sdk v1.16.2 h1:9sw/42Icwcsb4cSDx0ELqF4WhU95IRBVNvirDXIv6OY=
github.com/inference-gateway/sdk v1.16.2/go.mod h1:lNTq/c42VviO2pKPXdvEf/cWwFpgQjSX7CUP1F7T+0U=
github.com/inference-gateway/sdk v1.16.3 h1:qIiqYePG4GQyWE92iEPmxQsR0jBJDAG0u9h50CbspcU=
github.com/inference-gateway/sdk v1.16.3/go.mod h1:Qcm7duXS/Hz/xvs8yQhxLUbCUTWN/x88+npRWyeRst4=
github.com/invopop/jsonschema v0.12.0 h1:6ovsNSuvn9wEQVOyc72aycBMVQFKz7cPdMJn10CvzRI=
github.com/invopop/jsonschema v0.12.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0=
github.com/jezek/xgb v1.3.0 h1:Wa1pn4GVtcmNVAVB6/pnQVJ7xPFZVZ/W1Tc27msDhgI=
Expand Down Expand Up @@ -199,8 +199,8 @@ github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/oapi-codegen/runtime v1.1.2 h1:P2+CubHq8fO4Q6fV1tqDBZHCwpVpvPg7oKiYzQgXIyI=
github.com/oapi-codegen/runtime v1.1.2/go.mod h1:SK9X900oXmPWilYR5/WKPzt3Kqxn/uS/+lbpREv+eCg=
github.com/oapi-codegen/runtime v1.4.0 h1:KLOSFOp7UzkbS7Cs1ms6NBEKYr0WmH2wZG0KKbd2er4=
github.com/oapi-codegen/runtime v1.4.0/go.mod h1:5sw5fxCDmnOzKNYmkVNF8d34kyUeejJEY8HNT2WaPec=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
github.com/onsi/gomega v1.37.0 h1:CdEG8g0S133B4OswTDC/5XPSzE1OeP29QOioj2PID2Y=
Expand Down Expand Up @@ -341,8 +341,8 @@ golang.org/x/term v0.43.0 h1:S4RLU2sB31O/NCl+zFN9Aru9A/Cq2aqKpTZJ6B+DwT4=
golang.org/x/term v0.43.0/go.mod h1:lrhlHNdQJHO+1qVYiHfFKVuVioJIheAc3fBSMFYEIsk=
golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc=
golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38=
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c=
golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI=
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
Expand Down
Loading