( modelId: string, prefix: BedrockRegionPrefix, )
| 246 | * - applyBedrockRegionPrefix("claude-sonnet-4-5-20250929", "eu") → "claude-sonnet-4-5-20250929" (not a Bedrock model) |
| 247 | */ |
| 248 | export function applyBedrockRegionPrefix( |
| 249 | modelId: string, |
| 250 | prefix: BedrockRegionPrefix, |
| 251 | ): string { |
| 252 | // Check if it already has a region prefix and replace it |
| 253 | const existingPrefix = getBedrockRegionPrefix(modelId) |
| 254 | if (existingPrefix) { |
| 255 | return modelId.replace(`${existingPrefix}.`, `${prefix}.`) |
| 256 | } |
| 257 | |
| 258 | // Check if it's a foundation model (anthropic.*) and add the prefix |
| 259 | if (isFoundationModel(modelId)) { |
| 260 | return `${prefix}.${modelId}` |
| 261 | } |
| 262 | |
| 263 | // Not a Bedrock model format, return as-is |
| 264 | return modelId |
| 265 | } |
| 266 |
no test coverage detected