Skip to content

Commit

Permalink
bug fix: function call change arguments json format
Browse files Browse the repository at this point in the history
  • Loading branch information
devinyf committed Jul 30, 2024
1 parent e492fb2 commit c5a4a22
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion example/function_call/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ NEXT_ROUND:
fnName := toolCall.Function.Name
if fnName == "get_current_weather" {
argMap := toolCall.Function.GetArguments()
cityName := argMap["location"]
cityName := argMap["properties"]["location"]
toolAnswer := getCurrentWeather(cityName)
// fmt.Println("tool answer: ", tool_answer)

Expand Down
4 changes: 2 additions & 2 deletions qwen/func_call_dtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ type FunctionCall struct {
}

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

0 comments on commit c5a4a22

Please sign in to comment.