diff --git a/server/python_tools.go b/server/python_tools.go index d669f0be8..d307b3788 100644 --- a/server/python_tools.go +++ b/server/python_tools.go @@ -155,9 +155,9 @@ func parsePythonValue(value string) (any, error) { return nil, fmt.Errorf("invalid Python value: %s", value) } -// parsePythonFunctionCall parses Python function calls from a string +// parsePythonToolCall parses Python function calls from a string // it supports keyword arguments, as well as multiple functions in a single string -func parsePythonFunctionCall(s string) ([]api.ToolCall, error) { +func parsePythonToolCall(s string) ([]api.ToolCall, error) { matches := pythonFuncRegex.FindAllStringSubmatchIndex(s, -1) if len(matches) == 0 { return nil, fmt.Errorf("no Python function calls found") @@ -167,7 +167,7 @@ func parsePythonFunctionCall(s string) ([]api.ToolCall, error) { for _, match := range matches { name := s[match[2]:match[3]] args := s[match[4]:match[5]] - arguments := make(api.ToolCallFunctionArguments) + var arguments api.ToolCallFunctionArguments if len(args) == 0 { toolCalls = append(toolCalls, api.ToolCall{ Function: api.ToolCallFunction{ diff --git a/server/python_tools_test.go b/server/python_tools_test.go index e6908a8a2..06d76d4c1 100644 --- a/server/python_tools_test.go +++ b/server/python_tools_test.go @@ -143,7 +143,7 @@ func TestParsePythonFunctionCall(t *testing.T) { for _, tt := range cases { t.Run(tt.name, func(t *testing.T) { - got, err := parsePythonFunctionCall(tt.input) + got, err := parsePythonToolCall(tt.input) if (err != nil) != tt.err { t.Fatalf("expected error: %v, got error: %v", tt.err, err) }