fix(bedrock): normalize Mythos minimal effort

This commit is contained in:
Vincent Koc
2026-06-11 09:53:55 +09:00
parent aa5b1bd697
commit f76bdffd06
2 changed files with 27 additions and 3 deletions

View File

@@ -156,6 +156,26 @@ describe("createMantleAnthropicStreamFn", () => {
expect(streamOptions.effort).toBe("high");
});
it("maps Mythos Preview minimal reasoning to low effort", () => {
const model = createTestModel({
id: "anthropic.claude-mythos-preview",
name: "Claude Mythos Preview",
reasoning: true,
params: { canonicalModelId: "claude-mythos-preview" },
});
const deps = createTestDeps();
deps.stream.mockReturnValue({ kind: "anthropic-stream" } as never);
void createMantleAnthropicStreamFn(deps)(model, { messages: [] }, {
apiKey: "bedrock-bearer-token",
reasoning: "minimal",
});
const streamOptions = firstStreamOptions(deps);
expect(streamOptions.thinkingEnabled).toBe(true);
expect(streamOptions.effort).toBe("low");
});
it("normalizes Mantle provider URLs to the Anthropic endpoint", () => {
expect(resolveMantleAnthropicBaseUrl("https://bedrock-mantle.us-east-1.api.aws/v1")).toBe(
"https://bedrock-mantle.us-east-1.api.aws/anthropic",

View File

@@ -48,9 +48,13 @@ function resolveMantleReasoning(
return undefined;
}
const reasoning = options?.reasoning ?? (isClaudeMythosPreviewModel(model) ? "high" : undefined);
return isClaudeMythosPreviewModel(model) && (reasoning === "xhigh" || reasoning === "max")
? "high"
: reasoning;
if (!isClaudeMythosPreviewModel(model)) {
return reasoning;
}
if (reasoning === "minimal") {
return "low";
}
return reasoning === "xhigh" || reasoning === "max" ? "high" : reasoning;
}
function mergeHeaders(