Skip to content

Commit

Permalink
fix:fix open ai original validation. modify Tool's Function to pointer (
Browse files Browse the repository at this point in the history
sashabaranov#664)

Co-authored-by: caopengfei1 <caopengfei1@tal.com>
  • Loading branch information
CaoPengflying and caopengfei1-tal committed Feb 19, 2024
1 parent 69e3bbb commit e8b3478
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion examples/completion-with-tool/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e8b3478

Please sign in to comment.