diff --git a/chat.go b/chat.go index 33b8755..efb14fd 100644 --- a/chat.go +++ b/chat.go @@ -225,8 +225,8 @@ const ( ) type Tool struct { - Type ToolType `json:"type"` - Function FunctionDefinition `json:"function,omitempty"` + Type ToolType `json:"type"` + Function *FunctionDefinition `json:"function,omitempty"` } type ToolChoice struct { diff --git a/examples/completion-with-tool/main.go b/examples/completion-with-tool/main.go index 2c7fedc..26126e4 100644 --- a/examples/completion-with-tool/main.go +++ b/examples/completion-with-tool/main.go @@ -35,7 +35,7 @@ func main() { } t := openai.Tool{ Type: openai.ToolTypeFunction, - Function: f, + Function: &f, } // simulate user asking a question that requires the function