()
| 31 | } |
| 32 | |
| 33 | async function getBedrockModelStrings(): Promise<ModelStrings> { |
| 34 | const fallback = getBuiltinModelStrings('bedrock') |
| 35 | let profiles: string[] | undefined |
| 36 | try { |
| 37 | profiles = await getBedrockInferenceProfiles() |
| 38 | } catch (error) { |
| 39 | logError(error as Error) |
| 40 | return fallback |
| 41 | } |
| 42 | if (!profiles?.length) { |
| 43 | return fallback |
| 44 | } |
| 45 | // Each config's firstParty ID is the canonical substring we search for in the |
| 46 | // user's inference profile list (e.g. "claude-opus-4-6" matches |
| 47 | // "eu.anthropic.claude-opus-4-6-v1"). Fall back to the hardcoded bedrock ID |
| 48 | // when no matching profile is found. |
| 49 | const out = {} as ModelStrings |
| 50 | for (const key of MODEL_KEYS) { |
| 51 | const needle = ALL_MODEL_CONFIGS[key].firstParty |
| 52 | out[key] = findFirstMatch(profiles, needle) || fallback[key] |
| 53 | } |
| 54 | return out |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Layer user-configured modelOverrides (from settings.json) on top of the |
no test coverage detected