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:
CaoPengFlying
2024-02-19 20:26:04 +08:00
committed by GitHub
parent 69e3bbb1eb
commit e8b347891b
2 changed files with 3 additions and 3 deletions

View File

@@ -225,8 +225,8 @@ const (
) )
type Tool struct { type Tool struct {
Type ToolType `json:"type"` Type ToolType `json:"type"`
Function FunctionDefinition `json:"function,omitempty"` Function *FunctionDefinition `json:"function,omitempty"`
} }
type ToolChoice struct { type ToolChoice struct {

View File

@@ -35,7 +35,7 @@ func main() {
} }
t := openai.Tool{ t := openai.Tool{
Type: openai.ToolTypeFunction, Type: openai.ToolTypeFunction,
Function: f, Function: &f,
} }
// simulate user asking a question that requires the function // simulate user asking a question that requires the function