mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 09:01:14 +00:00
Merge pull request #1239 from unexge/push-qlzvuwsokuvn
chore(ai): clean up Bedrock-specific workarounds from `generate-models.ts`
This commit is contained in:
commit
1d8450ed6c
2 changed files with 55 additions and 47 deletions
|
|
@ -193,43 +193,12 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (id.startsWith("amazon.titan-text-express") ||
|
||||
id.startsWith("mistral.mistral-7b-instruct-v0")) {
|
||||
if (id.startsWith("mistral.mistral-7b-instruct-v0")) {
|
||||
// These models doesn't support system messages
|
||||
continue;
|
||||
}
|
||||
|
||||
// Some Amazon Bedrock models require cross-region inference profiles to work.
|
||||
// To use cross-region inference, we need to add a region prefix to the models.
|
||||
// See https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html#inference-profiles-support-system
|
||||
// TODO: Remove Claude models once https://github.com/anomalyco/models.dev/pull/607 is merged, and follow-up with other models.
|
||||
|
||||
// Models with global cross-region inference profiles
|
||||
if (id.startsWith("anthropic.claude-haiku-4-5") ||
|
||||
id.startsWith("anthropic.claude-sonnet-4") ||
|
||||
id.startsWith("anthropic.claude-opus-4-5") ||
|
||||
id.startsWith("amazon.nova-2-lite") ||
|
||||
id.startsWith("cohere.embed-v4") ||
|
||||
id.startsWith("twelvelabs.pegasus-1-2")) {
|
||||
id = "global." + id;
|
||||
}
|
||||
|
||||
// Models with US cross-region inference profiles
|
||||
if (id.startsWith("amazon.nova-lite") ||
|
||||
id.startsWith("amazon.nova-micro") ||
|
||||
id.startsWith("amazon.nova-premier") ||
|
||||
id.startsWith("amazon.nova-pro") ||
|
||||
id.startsWith("anthropic.claude-3-7-sonnet") ||
|
||||
id.startsWith("anthropic.claude-opus-4-1") ||
|
||||
id.startsWith("anthropic.claude-opus-4-20250514") ||
|
||||
id.startsWith("deepseek.r1") ||
|
||||
id.startsWith("meta.llama3-2") ||
|
||||
id.startsWith("meta.llama3-3") ||
|
||||
id.startsWith("meta.llama4")) {
|
||||
id = "us." + id;
|
||||
}
|
||||
|
||||
const bedrockModel = {
|
||||
models.push({
|
||||
id,
|
||||
name: m.name || id,
|
||||
api: "bedrock-converse-stream" as const,
|
||||
|
|
@ -245,19 +214,7 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
|
|||
},
|
||||
contextWindow: m.limit?.context || 4096,
|
||||
maxTokens: m.limit?.output || 4096,
|
||||
};
|
||||
models.push(bedrockModel);
|
||||
|
||||
// Add EU cross-region inference variants for Claude models
|
||||
if (modelId.startsWith("anthropic.claude-haiku-4-5") ||
|
||||
modelId.startsWith("anthropic.claude-sonnet-4-5") ||
|
||||
modelId.startsWith("anthropic.claude-opus-4-5")) {
|
||||
models.push({
|
||||
...bedrockModel,
|
||||
id: "eu." + modelId,
|
||||
name: (m.name || modelId) + " (EU)",
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,57 @@ import type { Model } from "./types.js";
|
|||
|
||||
export const MODELS = {
|
||||
"amazon-bedrock": {
|
||||
"amazon.nova-lite-v1:0": {
|
||||
id: "amazon.nova-lite-v1:0",
|
||||
name: "Nova Lite",
|
||||
api: "bedrock-converse-stream",
|
||||
provider: "amazon-bedrock",
|
||||
baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",
|
||||
reasoning: false,
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
input: 0.06,
|
||||
output: 0.24,
|
||||
cacheRead: 0.015,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 300000,
|
||||
maxTokens: 8192,
|
||||
} satisfies Model<"bedrock-converse-stream">,
|
||||
"amazon.nova-micro-v1:0": {
|
||||
id: "amazon.nova-micro-v1:0",
|
||||
name: "Nova Micro",
|
||||
api: "bedrock-converse-stream",
|
||||
provider: "amazon-bedrock",
|
||||
baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",
|
||||
reasoning: false,
|
||||
input: ["text"],
|
||||
cost: {
|
||||
input: 0.035,
|
||||
output: 0.14,
|
||||
cacheRead: 0.00875,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 128000,
|
||||
maxTokens: 8192,
|
||||
} satisfies Model<"bedrock-converse-stream">,
|
||||
"amazon.nova-pro-v1:0": {
|
||||
id: "amazon.nova-pro-v1:0",
|
||||
name: "Nova Pro",
|
||||
api: "bedrock-converse-stream",
|
||||
provider: "amazon-bedrock",
|
||||
baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",
|
||||
reasoning: false,
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
input: 0.8,
|
||||
output: 3.2,
|
||||
cacheRead: 0.2,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 300000,
|
||||
maxTokens: 8192,
|
||||
} satisfies Model<"bedrock-converse-stream">,
|
||||
"anthropic.claude-3-5-haiku-20241022-v1:0": {
|
||||
id: "anthropic.claude-3-5-haiku-20241022-v1:0",
|
||||
name: "Claude Haiku 3.5",
|
||||
|
|
@ -1010,7 +1061,7 @@ export const MODELS = {
|
|||
} satisfies Model<"bedrock-converse-stream">,
|
||||
"us.amazon.nova-pro-v1:0": {
|
||||
id: "us.amazon.nova-pro-v1:0",
|
||||
name: "Nova Pro",
|
||||
name: "Nova Pro (US)",
|
||||
api: "bedrock-converse-stream",
|
||||
provider: "amazon-bedrock",
|
||||
baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue