Skip to content

Commit

Permalink
feat: add Output field to FunctionCall struct
Browse files Browse the repository at this point in the history
- Added the `Output` field to the `FunctionCall` struct as described in the OpenAI API docs.
- This field is optional and is of type `*string`.
  • Loading branch information
harnyk committed Jan 15, 2025
1 parent 2a0ff5a commit a54e136
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ type ToolCall struct {
type FunctionCall struct {
Name string `json:"name,omitempty"`
// call function with arguments in JSON format
Arguments string `json:"arguments,omitempty"`
Arguments string `json:"arguments,omitempty"`
Output *string `json:"output,omitempty"`
}

type ChatCompletionResponseFormatType string
Expand Down
13 changes: 13 additions & 0 deletions run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func TestRun(t *testing.T) {
order := "desc"
after := "asst_abc122"
before := "asst_abc124"
functionCallOutput := "test"

client, server, teardown := setupOpenAITestServer()
defer teardown()
Expand Down Expand Up @@ -52,6 +53,18 @@ func TestRun(t *testing.T) {
Object: "run",
CreatedAt: 1234567890,
Status: openai.RunStepStatusCompleted,
StepDetails: openai.StepDetails{
Type: openai.RunStepTypeToolCalls,
ToolCalls: []openai.ToolCall{
{
Function: openai.FunctionCall{
Name: "test",
Arguments: "{}",
Output: &functionCallOutput,
},
},
},
},
},
},
})
Expand Down

0 comments on commit a54e136

Please sign in to comment.