Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions crates/goose/src/providers/azure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ impl AzureProvider {
.get_param("AZURE_OPENAI_API_VERSION")
.unwrap_or_else(|_| AZURE_DEFAULT_API_VERSION.to_string());

// Try to get API key first, if not found use Azure credential chain
let api_key = config.get_secret("AZURE_OPENAI_API_KEY").ok();
let api_key = config
.get_secret("AZURE_OPENAI_API_KEY")
.ok()
.filter(|key: &String| !key.is_empty());
let auth = AzureAuth::new(api_key)?;

let client = Client::builder()
Expand Down Expand Up @@ -227,6 +229,7 @@ impl Provider for AzureProvider {
ConfigKey::new("AZURE_OPENAI_ENDPOINT", true, false, None),
ConfigKey::new("AZURE_OPENAI_DEPLOYMENT_NAME", true, false, None),
ConfigKey::new("AZURE_OPENAI_API_VERSION", true, false, Some("2024-10-21")),
ConfigKey::new("AZURE_OPENAI_API_KEY", true, true, Some("")),
],
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,6 @@ export const PROVIDER_REGISTRY: ProviderRegistry[] = [
description:
'Access Azure OpenAI models using API key or Azure credentials. If no API key is provided, Azure credential chain will be used.',
parameters: [
{
name: 'AZURE_OPENAI_API_KEY',
is_secret: true,
required: false,
},
{
name: 'AZURE_OPENAI_ENDPOINT',
is_secret: false,
Expand All @@ -213,6 +208,11 @@ export const PROVIDER_REGISTRY: ProviderRegistry[] = [
is_secret: false,
default: '2024-10-21',
},
{
name: 'AZURE_OPENAI_API_KEY',
is_secret: true,
default: '',
},
],
},
},
Expand Down