Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 404
fix(runtime): emit camelCase OpenAI-compatible provider option keys#3321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
likun666661
merged 2 commits into
apache:main
from
yihanzhu:fix/openai-compatible-camelcase-provider-optionsAug 20, 2026
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
122 changes: 107 additions & 15 deletions
122 packages/runtime/src/__tests__/model-factory-thinking.test.ts
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -468,7 +468,7 @@ export function buildProviderOptions( | ||
| return buildFamilyWire(connection, modelId, level, thinkingOptions); | ||
| case 'volcengine-ark': | ||
| return { | ||
| [connection.providerType]: { | ||
| [toCamelCase(connection.providerType)]: { | ||
| thinking: { type: level === 'off' ? 'disabled' : 'enabled' }, | ||
| ...(level && level !== 'off' ? { reasoningEffort: level } : {}), | ||
| }, | ||
| @@ -495,7 +495,7 @@ export function buildProviderOptions( | ||
| case 'cloudflare-workers-ai': | ||
| return level | ||
| ? { | ||
| [connection.providerType]: | ||
| [toCamelCase(connection.providerType)]: | ||
| level === 'off' | ||
| ? thinkingOptions?.offBehavior === 'cloudflare-chat-template-thinking-false' | ||
| ? { chat_template_kwargs: { thinking: false } } | ||
| @@ -584,7 +584,7 @@ function buildFamilyWire( | ||
| if (copilotProtocol === 'anthropic-messages') { | ||
| return level !== 'off' ? { anthropic: { effort: level } } : {}; | ||
| } | ||
| return { 'github-copilot': { reasoningEffort } }; | ||
| return { githubCopilot: { reasoningEffort } }; | ||
| } | ||
| default: | ||
| return {}; | ||
| @@ -612,18 +612,21 @@ function toCamelCase(name: string): string { | ||
| } | ||
| /** | ||
| * The providerOptions key for an openai-compatible model. The SDK still | ||
| * accepts the raw provider name but flags dashed keys as deprecated (a | ||
| * `type: 'deprecated'` warning on every doGenerate result); its canonical | ||
| * key is the camelCase alias. Only the custom-relay path keys options by | ||
| * the connection slug, so only that path camelCases — built-in adapter | ||
| * namespaces stay as they were. | ||
| * The providerOptions key for an openai-compatible model: the camelCase | ||
| * alias of the identity passed to `createOpenAICompatible`. The SDK | ||
| * resolves both spellings — known options and passthrough fields alike — | ||
| * but flags dashed keys as deprecated (a `type: 'deprecated'` warning on | ||
| * every doGenerate result), so the camelCase alias is the canonical key. | ||
| * | ||
| * The same alias also selects the SDK's *response* metadata namespace: | ||
| * once options are keyed `zaiCodingPlan`, provider metadata comes back as | ||
| * `providerMetadata.zaiCodingPlan`, not `providerMetadata['zai-coding-plan']`. | ||
| * A metadata reader keyed by the raw `connection.providerType` would | ||
| * silently read nothing for dashed providers. | ||
| */ | ||
| function openAiCompatibleProviderOptionsKey( | ||
| adapter: ProviderRuntimeAdapter, | ||
| connection: RuntimeExecutionConnection, | ||
| ): string { | ||
| return adapter.kind === 'openai-compatible' && adapter.name === 'connection' | ||
| ? toCamelCase(connection.slug) | ||
| : connection.providerType; | ||
| return toCamelCase(openAiCompatibleProviderName(adapter, connection)); | ||
yihanzhu marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.