Skip to content

Commit e8b3478

Browse files
fix:fix open ai original validation. modify Tool's Function to pointer (#664)
Co-authored-by: caopengfei1 <[email protected]>
1 parent 69e3bbb commit e8b3478

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

chat.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ const (
225225
)
226226

227227
type Tool struct {
228-
Type ToolType `json:"type"`
229-
Function FunctionDefinition `json:"function,omitempty"`
228+
Type ToolType `json:"type"`
229+
Function *FunctionDefinition `json:"function,omitempty"`
230230
}
231231

232232
type ToolChoice struct {

examples/completion-with-tool/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func main() {
3535
}
3636
t := openai.Tool{
3737
Type: openai.ToolTypeFunction,
38-
Function: f,
38+
Function: &f,
3939
}
4040

4141
// simulate user asking a question that requires the function

0 commit comments

Comments
 (0)