fix:fix open ai original validation. modify Tool's Function to pointer (#664)
Co-authored-by: caopengfei1 <caopengfei1@tal.com>
This commit is contained in:
2
chat.go
2
chat.go
@@ -226,7 +226,7 @@ const (
|
||||
|
||||
type Tool struct {
|
||||
Type ToolType `json:"type"`
|
||||
Function FunctionDefinition `json:"function,omitempty"`
|
||||
Function *FunctionDefinition `json:"function,omitempty"`
|
||||
}
|
||||
|
||||
type ToolChoice struct {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user