fix: prevent double-prefixing of Bedrock cross-region inference models (#12056)

This commit is contained in:
Sergiy Dybskiy
2026-02-04 00:06:17 -05:00
committed by GitHub
parent f282613746
commit b942e0b4dc
2 changed files with 215 additions and 2 deletions

View File

@@ -239,7 +239,9 @@ export namespace Provider {
options: providerOptions,
async getModel(sdk: any, modelID: string, options?: Record<string, any>) {
// Skip region prefixing if model already has a cross-region inference profile prefix
if (modelID.startsWith("global.") || modelID.startsWith("jp.")) {
// Models from models.dev may already include prefixes like us., eu., global., etc.
const crossRegionPrefixes = ["global.", "us.", "eu.", "jp.", "apac.", "au."]
if (crossRegionPrefixes.some((prefix) => modelID.startsWith(prefix))) {
return sdk.languageModel(modelID)
}