Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
tools: return empty arguments object instead of null (#11113)
Jeffrey Morgan55bbf3b4a176
diff --git a/tools/tools.go b/tools/tools.goindex a86163baa..8a983e19f 100644--- a/tools/tools.go+++ b/tools/tools.go@@ -115,11 +115,10 @@ func (p *Parser) findTag() (int, bool) {// parseToolCall finds the next complete tool call in the buffer// incrementing n and advancing the buffer.func (p *Parser) parseToolCall() *api.ToolCall {- var args map[string]anyvar tool *api.Toolvar end int = len(p.buffer)-var i int+// find tool namefor _, t := range p.tools {n := t.Function.Name@@ -136,6 +135,7 @@ func (p *Parser) parseToolCall() *api.ToolCall {}// only look for arguments if the tool has parameters+ args := map[string]any{}if len(tool.Function.Parameters.Properties) > 0 {if args, i = p.findArguments(*tool); args == nil {return nildiff --git a/tools/tools_test.go b/tools/tools_test.goindex ebf4ad7dc..35b583438 100644--- a/tools/tools_test.go+++ b/tools/tools_test.go@@ -190,8 +190,9 @@ func TestParser(t *testing.T) {calls: []api.ToolCall{{Function: api.ToolCallFunction{- Index: 0,- Name: "say_hello",+ Index: 0,+ Name: "say_hello",+ Arguments: api.ToolCallFunctionArguments{},},},},@@ -265,8 +266,9 @@ func TestParser(t *testing.T) {calls: []api.ToolCall{{Function: api.ToolCallFunction{- Index: 0,- Name: "say_hello",+ Index: 0,+ Name: "say_hello",+ Arguments: api.ToolCallFunctionArguments{},},},{@@ -413,8 +415,9 @@ func TestParser(t *testing.T) {calls: []api.ToolCall{{Function: api.ToolCallFunction{- Index: 0,- Name: "say_hello",+ Index: 0,+ Name: "say_hello",+ Arguments: api.ToolCallFunctionArguments{},},},},@@ -441,8 +444,9 @@ func TestParser(t *testing.T) {calls: []api.ToolCall{{Function: api.ToolCallFunction{- Index: 0,- Name: "say_hello",+ Index: 0,+ Name: "say_hello",+ Arguments: api.ToolCallFunctionArguments{},},},},@@ -577,8 +581,9 @@ func TestParser(t *testing.T) {calls: []api.ToolCall{{Function: api.ToolCallFunction{- Index: 0,- Name: "say_hello",+ Index: 0,+ Name: "say_hello",+ Arguments: api.ToolCallFunctionArguments{},},},},