|
|
@@ -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 = [
|