fix(provider): avoid incompatible GPT-5 defaults and sanitize Gemini tool schemas#18915
Open
Haohao-end wants to merge 1 commit intoanomalyco:devfrom
Open
Conversation
cd702f5 to
b9d0041
Compare
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
6 tasks
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.
Issue for this PR
Closes #18882
Type of change
What does this PR do?
This fixes two compatibility problems from #18882.
ProviderTransform.options()was applying GPT-5 default request fields too broadly based on the model ID. That caused generic@ai-sdk/openai-compatibleproviders or proxies using models likegpt-5.4to receive fields such asreasoningSummary,reasoningEffort,textVerbosity, andinclude, even when the backend did not support them. This change limits those defaults to transports/providers that explicitly support them.This PR also tightens Gemini tool schema sanitization. The Gemini schema path now inlines local refs and recursively removes unsupported keys such as
$schema,additionalProperties,$ref,ref,$defs, anddefinitions. Structured output now reuses the same sanitization path so it does not bypass the Gemini-specific cleanup.How did you verify your code works?
I added regression tests covering:
@ai-sdk/openai-compatiblegpt-5.4models no longer receiving OpenAI-only defaultsopencode*GPT-5 providers still keeping supported defaultsI also ran:
git diff --checkcd packages/opencode && bun run typecheckbunx turbo typecheckScreenshots / recordings
Not a UI change.
Checklist
If you do not follow this template your PR will be automatically rejected.