fix: rm exclusion of ai-sdk/azure in transform.ts, when we migrated to v6 the ai sdk changed the key for ai-sdk/azure so the exclusion is no longer needed (#20326)
parent
beab4cc2c2
commit
4dd866d5c4
|
|
@ -292,7 +292,7 @@ export namespace ProviderTransform {
|
|||
|
||||
// Remap providerOptions keys from stored providerID to expected SDK key
|
||||
const key = sdkKey(model.api.npm)
|
||||
if (key && key !== model.providerID && model.api.npm !== "@ai-sdk/azure") {
|
||||
if (key && key !== model.providerID) {
|
||||
const remap = (opts: Record<string, any> | undefined) => {
|
||||
if (!opts) return opts
|
||||
if (!(model.providerID in opts)) return opts
|
||||
|
|
|
|||
|
|
@ -1557,6 +1557,35 @@ describe("ProviderTransform.message - providerOptions key remapping", () => {
|
|||
expect(result[0].providerOptions?.openai).toBeUndefined()
|
||||
})
|
||||
|
||||
test("azure cognitive services remaps providerID to 'azure' key", () => {
|
||||
const model = createModel("azure-cognitive-services", "@ai-sdk/azure")
|
||||
const msgs = [
|
||||
{
|
||||
role: "user",
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: "Hello",
|
||||
providerOptions: {
|
||||
"azure-cognitive-services": { part: true },
|
||||
},
|
||||
},
|
||||
],
|
||||
providerOptions: {
|
||||
"azure-cognitive-services": { someOption: "value" },
|
||||
},
|
||||
},
|
||||
] as any[]
|
||||
|
||||
const result = ProviderTransform.message(msgs, model, {}) as any[]
|
||||
const part = result[0].content[0] as any
|
||||
|
||||
expect(result[0].providerOptions?.azure).toEqual({ someOption: "value" })
|
||||
expect(result[0].providerOptions?.["azure-cognitive-services"]).toBeUndefined()
|
||||
expect(part.providerOptions?.azure).toEqual({ part: true })
|
||||
expect(part.providerOptions?.["azure-cognitive-services"]).toBeUndefined()
|
||||
})
|
||||
|
||||
test("copilot remaps providerID to 'copilot' key", () => {
|
||||
const model = createModel("github-copilot", "@ai-sdk/github-copilot")
|
||||
const msgs = [
|
||||
|
|
|
|||
Loading…
Reference in New Issue