feat: Support string|array output in FunctionToolCallOutput#699
Open
gembancud wants to merge 2 commits intoopenai-php:mainfrom
Open
feat: Support string|array output in FunctionToolCallOutput#699gembancud wants to merge 2 commits intoopenai-php:mainfrom
gembancud wants to merge 2 commits intoopenai-php:mainfrom
Conversation
- Update FunctionToolCallOutput to accept string|array for output parameter - This enables returning structured file/image references from function calls - Aligns with OpenAI's recent API update for file outputs in tool results - No breaking changes: existing string outputs continue to work
iBotPeaches
requested changes
Oct 7, 2025
Collaborator
iBotPeaches
left a comment
There was a problem hiding this comment.
thanks! Generally if we put array we need to have a typed class that represents that structure in the return. Otherwise consumers of the API just have array and they don't know that array's shape.
I can't find this stuff in the docs so not exactly sure what this looks like myself.
Add dedicated response classes for function tool call output content types (text, image, file) to provide type-safe structured output handling instead of generic arrays. This aligns with OpenAI API specification and enables proper static analysis. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Author
|
apologies for not including it but the shape should be documented in the openai api reference here |
iBotPeaches
reviewed
Oct 9, 2025
Collaborator
iBotPeaches
left a comment
There was a problem hiding this comment.
Looks like CI isn't happy due to some typing. I think expanding a test as well so we can capture this string vs array difference would be good.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What:
Description:
twitter
Openai released support for image and file inputs inside tool call results.
This PR aligns with that