|
@@ -613,6 +613,84 @@ describe("ProviderTransform.providerOptions", () => {
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ test("forces reasoning for custom OpenAI package models with explicit effort", () => {
|
|
|
|
|
+ const model = createModel({
|
|
|
|
|
+ providerID: "meta",
|
|
|
|
|
+ api: {
|
|
|
|
|
+ id: "muse-spark",
|
|
|
|
|
+ url: "https://api.ai.meta.com/v1",
|
|
|
|
|
+ npm: "@ai-sdk/openai",
|
|
|
|
|
+ },
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ expect(ProviderTransform.providerOptions(model, { reasoningEffort: "xhigh", reasoningSummary: "auto" })).toEqual({
|
|
|
|
|
+ openai: { forceReasoning: true, reasoningEffort: "xhigh", reasoningSummary: "auto" },
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ test("forces reasoning for OpenAI package models marked reasoning-capable", () => {
|
|
|
|
|
+ expect(ProviderTransform.providerOptions(createModel(), { store: false })).toEqual({
|
|
|
|
|
+ openai: { forceReasoning: true, store: false },
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ test("forces reasoning for explicit effort even when model is not marked reasoning-capable", () => {
|
|
|
|
|
+ const model = createModel({
|
|
|
|
|
+ capabilities: {
|
|
|
|
|
+ temperature: true,
|
|
|
|
|
+ reasoning: false,
|
|
|
|
|
+ attachment: true,
|
|
|
|
|
+ toolcall: true,
|
|
|
|
|
+ input: { text: true, audio: false, image: true, video: false, pdf: false },
|
|
|
|
|
+ output: { text: true, audio: false, image: false, video: false, pdf: false },
|
|
|
|
|
+ interleaved: false,
|
|
|
|
|
+ },
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ expect(ProviderTransform.providerOptions(model, { reasoningEffort: "xhigh" })).toEqual({
|
|
|
|
|
+ openai: { forceReasoning: true, reasoningEffort: "xhigh" },
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ test("forces reasoning for Azure OpenAI models with explicit effort", () => {
|
|
|
|
|
+ const model = createModel({
|
|
|
|
|
+ providerID: "azure",
|
|
|
|
|
+ api: {
|
|
|
|
|
+ id: "custom-gpt-5-deployment",
|
|
|
|
|
+ url: "https://azure.openai.example.com/openai/v1",
|
|
|
|
|
+ npm: "@ai-sdk/azure",
|
|
|
|
|
+ },
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ expect(ProviderTransform.providerOptions(model, { reasoningEffort: "xhigh" })).toEqual({
|
|
|
|
|
+ openai: { forceReasoning: true, reasoningEffort: "xhigh" },
|
|
|
|
|
+ azure: { forceReasoning: true, reasoningEffort: "xhigh" },
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ test("forces reasoning for Bedrock Mantle OpenAI models with explicit effort", () => {
|
|
|
|
|
+ const model = createModel({
|
|
|
|
|
+ providerID: "amazon-bedrock",
|
|
|
|
|
+ api: {
|
|
|
|
|
+ id: "openai.gpt-5-custom",
|
|
|
|
|
+ url: "https://bedrock-mantle.us-east-2.api.aws/openai/v1",
|
|
|
|
|
+ npm: "@ai-sdk/amazon-bedrock/mantle",
|
|
|
|
|
+ },
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ expect(ProviderTransform.providerOptions(model, { reasoningEffort: "xhigh" })).toEqual({
|
|
|
|
|
+ openai: { forceReasoning: true, reasoningEffort: "xhigh" },
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ test("overrides forceReasoning false when reasoning should be forced", () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ ProviderTransform.providerOptions(createModel(), { forceReasoning: false, reasoningEffort: "xhigh" }),
|
|
|
|
|
+ ).toEqual({
|
|
|
|
|
+ openai: { forceReasoning: true, reasoningEffort: "xhigh" },
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
test("uses gateway model provider slug for gateway models", () => {
|
|
test("uses gateway model provider slug for gateway models", () => {
|
|
|
const model = createModel({
|
|
const model = createModel({
|
|
|
providerID: "vercel",
|
|
providerID: "vercel",
|
|
@@ -707,7 +785,7 @@ describe("ProviderTransform.providerOptions", () => {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
expect(ProviderTransform.providerOptions(model, { reasoningEffort: "medium" })).toEqual({
|
|
expect(ProviderTransform.providerOptions(model, { reasoningEffort: "medium" })).toEqual({
|
|
|
- openai: { reasoningEffort: "medium" },
|
|
|
|
|
|
|
+ openai: { forceReasoning: true, reasoningEffort: "medium" },
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|