bedrock: Fix cross-region inference (#30659)

Closes #30535

Release Notes:

- AWS Bedrock: Add support for Meta Llama 4 Scout and Maverick models.
- AWS Bedrock: Fixed cross-region inference for all regions.
- AWS Bedrock: Updated all models available through Cross Region
inference.

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
This commit is contained in:
Shardul Vaidya 2025-06-03 11:46:35 -04:00 committed by GitHub
parent c0397727e0
commit e13b494c9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 105 additions and 84 deletions

View file

@ -531,13 +531,13 @@ impl LanguageModel for BedrockModel {
> {
let Ok(region) = cx.read_entity(&self.state, |state, _cx| {
// Get region - from credentials or directly from settings
let region = state
.credentials
.as_ref()
.map(|s| s.region.clone())
.unwrap_or(String::from("us-east-1"));
let credentials_region = state.credentials.as_ref().map(|s| s.region.clone());
let settings_region = state.settings.as_ref().and_then(|s| s.region.clone());
region
// Use credentials region if available, otherwise use settings region, finally fall back to default
credentials_region
.or(settings_region)
.unwrap_or(String::from("us-east-1"))
}) else {
return async move {
anyhow::bail!("App State Dropped");