mirror of
https://github.com/aljazceru/goose.git
synced 2026-02-23 07:24:24 +01:00
feat: Add AZURE_OPENAI_API_KEY as a visible config parameter (#3265)
This commit is contained in:
@@ -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()
|
||||
@@ -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("")),
|
||||
],
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
@@ -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: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user