Skip to content

Commit c5a4a22

Browse files
committed
bug fix: function call change arguments json format
1 parent e492fb2 commit c5a4a22

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

example/function_call/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ NEXT_ROUND:
7777
fnName := toolCall.Function.Name
7878
if fnName == "get_current_weather" {
7979
argMap := toolCall.Function.GetArguments()
80-
cityName := argMap["location"]
80+
cityName := argMap["properties"]["location"]
8181
toolAnswer := getCurrentWeather(cityName)
8282
// fmt.Println("tool answer: ", tool_answer)
8383

qwen/func_call_dtypes.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ type FunctionCall struct {
4242
}
4343

4444
// API 接口返回的是 string, 这里转换为 map.
45-
func (f FunctionCall) GetArguments() map[string]string {
46-
argMap := make(map[string]string)
45+
func (f FunctionCall) GetArguments() map[string]map[string]string {
46+
argMap := make(map[string]map[string]string)
4747
err := json.Unmarshal([]byte(f.Arguments), &argMap)
4848
if err != nil {
4949
panic(err)

0 commit comments

Comments
 (0)