Merge pull request #1 from KevinZhao/refactor/remove-deprecated-bedrock-models

refactor: remove deprecated Claude 2 and Titan embedding models from Bedrock
This commit is contained in:
Kevin Zhao 2025-11-13 14:04:41 +08:00 committed by GitHub
commit 6d86f4e323
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 16 additions and 59 deletions

View file

@ -62,7 +62,7 @@ describe("getApiProtocol", () => {
it("should return 'openai' for non-anthropic providers regardless of model", () => {
expect(getApiProtocol("openrouter", "claude-3-opus")).toBe("openai")
expect(getApiProtocol("openai", "claude-3-sonnet")).toBe("openai")
expect(getApiProtocol("litellm", "claude-instant")).toBe("openai")
expect(getApiProtocol("litellm", "anthropic.claude-sonnet-4-5-20250929-v1:0")).toBe("openai")
expect(getApiProtocol("ollama", "claude-model")).toBe("openai")
})
})
@ -80,7 +80,7 @@ describe("getApiProtocol", () => {
it("should be case-insensitive for claude detection", () => {
expect(getApiProtocol("vertex", "CLAUDE-3-OPUS")).toBe("anthropic")
expect(getApiProtocol("vertex", "claude-3-opus")).toBe("anthropic")
expect(getApiProtocol("vertex", "ClAuDe-InStAnT")).toBe("anthropic")
expect(getApiProtocol("vertex", "ClAuDe-SoNnEt-4-5")).toBe("anthropic")
})
})
})

View file

@ -205,33 +205,6 @@ export const bedrockModels = {
inputPrice: 0.25,
outputPrice: 1.25,
},
"anthropic.claude-2-1-v1:0": {
maxTokens: 4096,
contextWindow: 100_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 8.0,
outputPrice: 24.0,
description: "Claude 2.1",
},
"anthropic.claude-2-0-v1:0": {
maxTokens: 4096,
contextWindow: 100_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 8.0,
outputPrice: 24.0,
description: "Claude 2.0",
},
"anthropic.claude-instant-v1:0": {
maxTokens: 4096,
contextWindow: 100_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.8,
outputPrice: 2.4,
description: "Claude Instant",
},
"deepseek.r1-v1:0": {
maxTokens: 32_768,
contextWindow: 128_000,
@ -373,22 +346,6 @@ export const bedrockModels = {
outputPrice: 0.6,
description: "Amazon Titan Text Express",
},
"amazon.titan-text-embeddings-v1:0": {
maxTokens: 8192,
contextWindow: 8_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.1,
description: "Amazon Titan Text Embeddings",
},
"amazon.titan-text-embeddings-v2:0": {
maxTokens: 8192,
contextWindow: 8_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.02,
description: "Amazon Titan Text Embeddings V2",
},
} as const satisfies Record<string, ModelInfo>
export const BEDROCK_DEFAULT_TEMPERATURE = 0.3

View file

@ -122,7 +122,7 @@ describe("AwsBedrockHandler with invokedModelId", () => {
trace: {
promptRouter: {
invokedModelId:
"arn:aws:bedrock:us-west-2:699475926481:inference-profile/us.anthropic.claude-2-1-v1:0",
"arn:aws:bedrock:us-west-2:699475926481:inference-profile/us.anthropic.claude-sonnet-4-5-20250929-v1:0",
usage: {
inputTokens: 150,
outputTokens: 250,
@ -162,12 +162,12 @@ describe("AwsBedrockHandler with invokedModelId", () => {
}
// Verify that getModelById was called with the id, not the full arn
expect(getModelByIdSpy).toHaveBeenCalledWith("anthropic.claude-2-1-v1:0", "inference-profile")
expect(getModelByIdSpy).toHaveBeenCalledWith("anthropic.claude-sonnet-4-5-20250929-v1:0", "inference-profile")
// Verify that getModel returns the updated model info
const costModel = handler.getModel()
//expect(costModel.id).toBe("anthropic.claude-3-5-sonnet-20240620-v1:0")
expect(costModel.info.inputPrice).toBe(8)
expect(costModel.info.inputPrice).toBe(3)
// Verify that a usage event was emitted after updating the costModelConfig
const usageEvents = events.filter((event) => event.type === "usage")

View file

@ -807,9 +807,9 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
* macOS, Linux, and any other operating system where JavaScript runs.
*
* This matches ARNs like:
* - Foundation Model: arn:aws:bedrock:us-west-2::foundation-model/anthropic.claude-v2
* - Foundation Model: arn:aws:bedrock:us-west-2::foundation-model/anthropic.claude-sonnet-4-20250514-v1:0
* - Prompt Router: arn:aws:bedrock:us-west-2:123456789012:prompt-router/anthropic-claude
* - Inference Profile: arn:aws:bedrock:us-west-2:123456789012:inference-profile/anthropic.claude-v2
* - Inference Profile: arn:aws:bedrock:us-west-2:123456789012:inference-profile/anthropic.claude-opus-4-20250514-v1:0
* - Cross Region Inference Profile: arn:aws:bedrock:us-west-2:123456789012:inference-profile/us.anthropic.claude-3-5-sonnet-20241022-v2:0
* - Custom Model (Provisioned Throughput): arn:aws:bedrock:us-west-2:123456789012:provisioned-model/my-custom-model
* - Imported Model: arn:aws:bedrock:us-west-2:123456789012:imported-model/my-imported-model

View file

@ -1454,7 +1454,7 @@ describe("Cline", () => {
const claudeModelFormats = [
"claude-3-opus",
"Claude-3-Sonnet",
"CLAUDE-instant",
"CLAUDE-sonnet-4-5",
"anthropic/claude-3-haiku",
"some-provider/claude-model",
]

View file

@ -582,8 +582,8 @@ describe("ClineProvider - API Handler Rebuild Guard", () => {
)
expect(getModelId({ apiProvider: "openai", openAiModelId: "gpt-4-turbo" })).toBe("gpt-4-turbo")
expect(getModelId({ apiProvider: "glama", glamaModelId: "some-model" })).toBe("some-model")
expect(getModelId({ apiProvider: "bedrock", apiModelId: "anthropic.claude-v2" })).toBe(
"anthropic.claude-v2",
expect(getModelId({ apiProvider: "bedrock", apiModelId: "anthropic.claude-sonnet-4-5-20250929-v1:0" })).toBe(
"anthropic.claude-sonnet-4-5-20250929-v1:0",
)
})

View file

@ -131,7 +131,7 @@ describe("ApiConfigSelector", () => {
{ id: "config4", name: "Config 4", modelId: "gpt-3.5-turbo" },
{ id: "config5", name: "Config 5", modelId: "claude-3-haiku-20240307" },
{ id: "config6", name: "Config 6", modelId: "gpt-4-turbo" },
{ id: "config7", name: "Config 7", modelId: "claude-2.1" },
{ id: "config7", name: "Config 7", modelId: "anthropic.claude-sonnet-4-5-20250929-v1:0" },
],
}
render(<ApiConfigSelector {...props} />)
@ -165,7 +165,7 @@ describe("ApiConfigSelector", () => {
{ id: "config4", name: "Config 4", modelId: "gpt-3.5-turbo" },
{ id: "config5", name: "Config 5", modelId: "claude-3-haiku-20240307" },
{ id: "config6", name: "Config 6", modelId: "gpt-4-turbo" },
{ id: "config7", name: "Config 7", modelId: "claude-2.1" },
{ id: "config7", name: "Config 7", modelId: "anthropic.claude-sonnet-4-5-20250929-v1:0" },
],
}
render(<ApiConfigSelector {...props} />)
@ -195,7 +195,7 @@ describe("ApiConfigSelector", () => {
{ id: "config4", name: "Config 4", modelId: "gpt-3.5-turbo" },
{ id: "config5", name: "Config 5", modelId: "claude-3-haiku-20240307" },
{ id: "config6", name: "Config 6", modelId: "gpt-4-turbo" },
{ id: "config7", name: "Config 7", modelId: "claude-2.1" },
{ id: "config7", name: "Config 7", modelId: "anthropic.claude-sonnet-4-5-20250929-v1:0" },
],
}
render(<ApiConfigSelector {...props} />)
@ -221,7 +221,7 @@ describe("ApiConfigSelector", () => {
{ id: "config4", name: "Config 4", modelId: "gpt-3.5-turbo" },
{ id: "config5", name: "Config 5", modelId: "claude-3-haiku-20240307" },
{ id: "config6", name: "Config 6", modelId: "gpt-4-turbo" },
{ id: "config7", name: "Config 7", modelId: "claude-2.1" },
{ id: "config7", name: "Config 7", modelId: "anthropic.claude-sonnet-4-5-20250929-v1:0" },
],
}
render(<ApiConfigSelector {...props} />)
@ -357,7 +357,7 @@ describe("ApiConfigSelector", () => {
{ id: "config4", name: "Config 4", modelId: "gpt-3.5-turbo" },
{ id: "config5", name: "Config 5", modelId: "claude-3-haiku-20240307" },
{ id: "config6", name: "Config 6", modelId: "gpt-4-turbo" },
{ id: "config7", name: "Config 7", modelId: "claude-2.1" },
{ id: "config7", name: "Config 7", modelId: "anthropic.claude-sonnet-4-5-20250929-v1:0" },
],
}
render(<ApiConfigSelector {...props} />)
@ -414,7 +414,7 @@ describe("ApiConfigSelector", () => {
{ id: "config4", name: "Config 4", modelId: "gpt-3.5-turbo" },
{ id: "config5", name: "Config 5", modelId: "claude-3-haiku-20240307" },
{ id: "config6", name: "Config 6", modelId: "gpt-4-turbo" },
{ id: "config7", name: "Config 7", modelId: "claude-2.1" },
{ id: "config7", name: "Config 7", modelId: "anthropic.claude-sonnet-4-5-20250929-v1:0" },
],
}
render(<ApiConfigSelector {...props} />)