|
|
@@ -3290,6 +3290,27 @@ describe("ProviderTransform.variants", () => {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
+ test("anthropic sonnet 5 returns adaptive thinking options with xhigh", () => {
|
|
|
+ const model = createMockModel({
|
|
|
+ id: "anthropic/claude-sonnet-5",
|
|
|
+ providerID: "gateway",
|
|
|
+ api: {
|
|
|
+ id: "anthropic/claude-sonnet-5",
|
|
|
+ url: "https://gateway.ai",
|
|
|
+ npm: "@ai-sdk/gateway",
|
|
|
+ },
|
|
|
+ })
|
|
|
+ const result = ProviderTransform.variants(model)
|
|
|
+ expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh", "max"])
|
|
|
+ expect(result.high).toEqual({
|
|
|
+ thinking: {
|
|
|
+ type: "adaptive",
|
|
|
+ display: "summarized",
|
|
|
+ },
|
|
|
+ effort: "high",
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
test("anthropic opus 4.6 omits display so it keeps the summarized default", () => {
|
|
|
const model = createMockModel({
|
|
|
id: "anthropic/claude-opus-4-6",
|
|
|
@@ -3877,6 +3898,12 @@ describe("ProviderTransform.variants", () => {
|
|
|
efforts: ["low", "medium", "high", "xhigh", "max"],
|
|
|
expectedHigh: { thinking: { type: "adaptive", display: "summarized" }, effort: "high" },
|
|
|
},
|
|
|
+ {
|
|
|
+ name: "sonnet 5",
|
|
|
+ apiIds: ["claude-sonnet-5", "claude-sonnet-5-20260630"],
|
|
|
+ efforts: ["low", "medium", "high", "xhigh", "max"],
|
|
|
+ expectedHigh: { thinking: { type: "adaptive", display: "summarized" }, effort: "high" },
|
|
|
+ },
|
|
|
{
|
|
|
name: "fable 5",
|
|
|
apiIds: ["claude-fable-5"],
|
|
|
@@ -3974,6 +4001,28 @@ describe("ProviderTransform.variants", () => {
|
|
|
effort: "high",
|
|
|
})
|
|
|
})
|
|
|
+
|
|
|
+ test("sonnet 5 uses adaptive reasoning for Vertex model IDs", () => {
|
|
|
+ const result = ProviderTransform.variants(
|
|
|
+ createMockModel({
|
|
|
+ id: "google-vertex-anthropic/claude-sonnet-5@default",
|
|
|
+ providerID: "google-vertex-anthropic",
|
|
|
+ api: {
|
|
|
+ id: "claude-sonnet-5@default",
|
|
|
+ url: "https://us-central1-aiplatform.googleapis.com",
|
|
|
+ npm: "@ai-sdk/google-vertex/anthropic",
|
|
|
+ },
|
|
|
+ }),
|
|
|
+ )
|
|
|
+ expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh", "max"])
|
|
|
+ expect(result.high).toEqual({
|
|
|
+ thinking: {
|
|
|
+ type: "adaptive",
|
|
|
+ display: "summarized",
|
|
|
+ },
|
|
|
+ effort: "high",
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
describe("@ai-sdk/amazon-bedrock", () => {
|
|
|
@@ -4047,6 +4096,28 @@ describe("ProviderTransform.variants", () => {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
+ test("anthropic sonnet 5 returns adaptive reasoning options with xhigh", () => {
|
|
|
+ const result = ProviderTransform.variants(
|
|
|
+ createMockModel({
|
|
|
+ id: "bedrock/anthropic-claude-sonnet-5",
|
|
|
+ providerID: "bedrock",
|
|
|
+ api: {
|
|
|
+ id: "anthropic.claude-sonnet-5",
|
|
|
+ url: "https://bedrock.amazonaws.com",
|
|
|
+ npm: "@ai-sdk/amazon-bedrock",
|
|
|
+ },
|
|
|
+ }),
|
|
|
+ )
|
|
|
+ expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh", "max"])
|
|
|
+ expect(result.high).toEqual({
|
|
|
+ reasoningConfig: {
|
|
|
+ type: "adaptive",
|
|
|
+ maxReasoningEffort: "high",
|
|
|
+ display: "summarized",
|
|
|
+ },
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
test("returns WIDELY_SUPPORTED_EFFORTS with reasoningConfig", () => {
|
|
|
const model = createMockModel({
|
|
|
id: "bedrock/llama-4",
|
|
|
@@ -4229,6 +4300,12 @@ describe("ProviderTransform.variants", () => {
|
|
|
efforts: ["low", "medium", "high", "xhigh", "max"],
|
|
|
thinking: { type: "adaptive", display: "summarized" },
|
|
|
},
|
|
|
+ {
|
|
|
+ name: "sonnet 5",
|
|
|
+ apiIds: ["anthropic--claude-sonnet-5", "anthropic--claude-5-sonnet"],
|
|
|
+ efforts: ["low", "medium", "high", "xhigh", "max"],
|
|
|
+ thinking: { type: "adaptive", display: "summarized" },
|
|
|
+ },
|
|
|
]) {
|
|
|
for (const apiId of testCase.apiIds) {
|
|
|
test(`${testCase.name} ${apiId} returns adaptive thinking variants under modelParams`, () => {
|