fix(provider): split providerOptions key on dot for openai-compatible, openai, and anthropic providers (#25145)
This commit is contained in:
parent
247284b9af
commit
a12333310f
1 changed files with 14 additions and 1 deletions
|
|
@ -1058,7 +1058,20 @@ export function providerOptions(model: Provider.Model, options: { [x: string]: a
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
const key = sdkKey(model.api.npm) ?? model.providerID
|
// AI SDK packages that resolve providerOptionsName by splitting the
|
||||||
|
// provider name on "." (e.g. "wafer.ai" -> "wafer") need the same
|
||||||
|
// logic here so the key we write matches the key they read.
|
||||||
|
// Other SDKs (xai, mistral, groq, cohere, etc.) use hardcoded keys
|
||||||
|
// like "xai" or "cohere" - applying .split(".")[0] would break those.
|
||||||
|
const usesDotSplitOptions =
|
||||||
|
model.api.npm === "@ai-sdk/openai-compatible" ||
|
||||||
|
model.api.npm === "@ai-sdk/openai" ||
|
||||||
|
model.api.npm === "@ai-sdk/anthropic"
|
||||||
|
const key =
|
||||||
|
sdkKey(model.api.npm) ??
|
||||||
|
(usesDotSplitOptions
|
||||||
|
? model.providerID.split(".")[0]
|
||||||
|
: model.providerID)
|
||||||
// @ai-sdk/azure delegates to OpenAIChatLanguageModel which reads from
|
// @ai-sdk/azure delegates to OpenAIChatLanguageModel which reads from
|
||||||
// providerOptions["openai"], but OpenAIResponsesLanguageModel checks
|
// providerOptions["openai"], but OpenAIResponsesLanguageModel checks
|
||||||
// "azure" first. Pass both so model options work on either code path.
|
// "azure" first. Pass both so model options work on either code path.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue