feat: add support for Gemini extra_content in tool calls#745
Open
ivanmestre wants to merge 1 commit intoopenai-php:mainfrom
Open
feat: add support for Gemini extra_content in tool calls#745ivanmestre wants to merge 1 commit intoopenai-php:mainfrom
ivanmestre wants to merge 1 commit intoopenai-php:mainfrom
Conversation
- Created `CreateResponseToolCallExtraContent` and `CreateResponseToolCallExtraContentGoogle` DTOs to handle Gemini's specific tool call payloads (e.g., thought signatures). - Added `?CreateResponseToolCallExtraContent $extra_content` to `CreateResponseToolCall`. - Updated `toArray()` methods across these DTOs to dynamically strip `extra_content` when null or empty, preventing strict schema validation errors in other providers like Mistral.
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:
This PR adds support for the
extra_contentpayload returned by Gemini API tool calls, which includes provider-specific data likethought_signature.Changes Introduced:
CreateResponseToolCallExtraContentandCreateResponseToolCallExtraContentGoogleto capture the Gemini payloads.?CreateResponseToolCallExtraContent $extra_contenttoCreateResponseToolCall.toArray()methods across these DTOs to strip theextra_contentandgooglekeys when they arenullor empty.Why filter
nullvalues?APIs with strict schema validation (like Mistral) throw "Extra inputs are not permitted" errors if they receive
"extra_content": nullin the message history. Conditionally stripping these keys ensures developers can seamlessly reuse these response objects across different API providers without writing custom payload-stripping logic.