fix: recognize Bedrock as Anthropic-compatible in transcript policy

This commit is contained in:
JackyWay
2026-02-24 00:49:03 +08:00
parent 89a4695020
commit 3b5154081c
2 changed files with 15 additions and 2 deletions

View File

@@ -53,6 +53,19 @@ describe("resolveTranscriptPolicy", () => {
expect(policy.validateAnthropicTurns).toBe(true);
});
it("enables Anthropic-compatible policies for Bedrock provider", () => {
const policy = resolveTranscriptPolicy({
provider: "amazon-bedrock",
modelId: "us.anthropic.claude-opus-4-6-v1",
modelApi: "bedrock-converse-stream",
});
expect(policy.repairToolUseResultPairing).toBe(true);
expect(policy.validateAnthropicTurns).toBe(true);
expect(policy.allowSyntheticToolResults).toBe(true);
expect(policy.sanitizeToolCallIds).toBe(true);
expect(policy.sanitizeMode).toBe("full");
});
it("keeps OpenRouter on its existing turn-validation path", () => {
const policy = resolveTranscriptPolicy({
provider: "openrouter",

View File

@@ -55,12 +55,12 @@ function isOpenAiProvider(provider?: string | null): boolean {
}
function isAnthropicApi(modelApi?: string | null, provider?: string | null): boolean {
if (modelApi === "anthropic-messages") {
if (modelApi === "anthropic-messages" || modelApi === "bedrock-converse-stream") {
return true;
}
const normalized = normalizeProviderId(provider ?? "");
// MiniMax now uses openai-completions API, not anthropic-messages
return normalized === "anthropic";
return normalized === "anthropic" || normalized === "amazon-bedrock";
}
function isMistralModel(params: { provider?: string | null; modelId?: string | null }): boolean {