go-openai
go-openai copied to clipboard
feat: add Output field to FunctionCall struct
Describe the change
- Added the
Outputfield to theFunctionCallstruct as described in the OpenAI API docs. - This field is optional and is of type
*string.
Provide OpenAI documentation link
https://platform.openai.com/docs/api-reference/run-steps/step-object#run-steps/step-object-step_details
See: step_details / Tool Calls / tool_calls / Function tool call / function / output
Describe your solution The output field is provided with FunctionCall in the Assistants API context, when the function result has been already submitted.
Tests Unit tests updated, see the changes.
Additional context I developed a CLI tool for retrieving and viewing OpenAI assistant thread history using Assistants API: https://github.com/harnyk/threadviewer/
But I had to vendor and patch go-openai library in-place in order to make it support function call output field:
- The patch: https://github.com/harnyk/threadviewer/blob/master/openai-client.patch
- https://github.com/harnyk/threadviewer/blob/master/apply-patch.sh