bedrock: Fix region bug (#25716)
Closes #25714 Internal team reported issue where the Bedrock provider defaulted to "us-east-1" for all requests regardless of what is configured in the credentials until first zed restart. Release Notes: - Fixed an issue where the Bedrock model provider would not always respect the region.
This commit is contained in:
parent
84ded96cb2
commit
11838cf89e
1 changed files with 2 additions and 4 deletions
|
@ -83,7 +83,6 @@ const ZED_AWS_CREDENTIALS_VAR: &str = "ZED_AWS_CREDENTIALS";
|
||||||
pub struct State {
|
pub struct State {
|
||||||
credentials: Option<BedrockCredentials>,
|
credentials: Option<BedrockCredentials>,
|
||||||
credentials_from_env: bool,
|
credentials_from_env: bool,
|
||||||
region: Option<String>,
|
|
||||||
_subscription: Subscription,
|
_subscription: Subscription,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +174,6 @@ impl BedrockLanguageModelProvider {
|
||||||
pub fn new(http_client: Arc<dyn HttpClient>, cx: &mut App) -> Self {
|
pub fn new(http_client: Arc<dyn HttpClient>, cx: &mut App) -> Self {
|
||||||
let state = cx.new(|cx| State {
|
let state = cx.new(|cx| State {
|
||||||
credentials: None,
|
credentials: None,
|
||||||
region: Some(String::from("us-east-1")),
|
|
||||||
credentials_from_env: false,
|
credentials_from_env: false,
|
||||||
_subscription: cx.observe_global::<SettingsStore>(|_, cx| {
|
_subscription: cx.observe_global::<SettingsStore>(|_, cx| {
|
||||||
cx.notify();
|
cx.notify();
|
||||||
|
@ -311,7 +309,7 @@ impl BedrockModel {
|
||||||
Ok((
|
Ok((
|
||||||
credentials.access_key_id.clone(),
|
credentials.access_key_id.clone(),
|
||||||
credentials.secret_access_key.clone(),
|
credentials.secret_access_key.clone(),
|
||||||
state.region.clone(),
|
credentials.region.clone(),
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
return Err(anyhow!("Failed to read credentials"));
|
return Err(anyhow!("Failed to read credentials"));
|
||||||
|
@ -331,7 +329,7 @@ impl BedrockModel {
|
||||||
None,
|
None,
|
||||||
"Keychain",
|
"Keychain",
|
||||||
))
|
))
|
||||||
.region(Region::new(region.unwrap()))
|
.region(Region::new(region))
|
||||||
.http_client(self.http_client.clone())
|
.http_client(self.http_client.clone())
|
||||||
.build(),
|
.build(),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue