bedrock: Support global endpoints and new regional endpoints (#44103)

Closes #43598

Release Notes:

- bedrock: Added opt-in `allow_global` which enables global endpoints
- bedrock: Updated cross-region-inference endpoint and model list
- bedrock: Fixed Opus 4.5 access on Bedrock, now only accessible through the `allow_global` setting
This commit is contained in:
Shardul Vaidya
2025-12-04 12:14:31 +01:00
committed by GitHub
parent 9db0d66251
commit 0f0017dc8e
5 changed files with 186 additions and 61 deletions
+12 -2
View File
@@ -71,6 +71,7 @@ pub struct AmazonBedrockSettings {
pub profile_name: Option<String>,
pub role_arn: Option<String>,
pub authentication_method: Option<BedrockAuthMethod>,
pub allow_global: Option<bool>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, EnumIter, IntoStaticStr, JsonSchema)]
@@ -239,6 +240,13 @@ impl State {
.or(settings_region)
.unwrap_or(String::from("us-east-1"))
}
fn get_allow_global(&self) -> bool {
self.settings
.as_ref()
.and_then(|s| s.allow_global)
.unwrap_or(false)
}
}
pub struct BedrockLanguageModelProvider {
@@ -545,11 +553,13 @@ impl LanguageModel for BedrockModel {
LanguageModelCompletionError,
>,
> {
let Ok(region) = cx.read_entity(&self.state, |state, _cx| state.get_region()) else {
let Ok((region, allow_global)) = cx.read_entity(&self.state, |state, _cx| {
(state.get_region(), state.get_allow_global())
}) else {
return async move { Err(anyhow::anyhow!("App State Dropped").into()) }.boxed();
};
let model_id = match self.model.cross_region_inference_id(&region) {
let model_id = match self.model.cross_region_inference_id(&region, allow_global) {
Ok(s) => s,
Err(e) => {
return async move { Err(e.into()) }.boxed();
+1
View File
@@ -58,6 +58,7 @@ impl settings::Settings for AllLanguageModelSettings {
profile_name: bedrock.profile,
role_arn: None, // todo(was never a setting for this...)
authentication_method: bedrock.authentication_method.map(Into::into),
allow_global: bedrock.allow_global,
},
deepseek: DeepSeekSettings {
api_url: deepseek.api_url.unwrap(),