feat: Add AZURE_OPENAI_API_KEY as a visible config parameter (#3265)

This commit is contained in:
Marko Lazaric
2025-07-15 00:28:25 +02:00
committed by GitHub
parent fde3a578a5
commit c7043190e3
2 changed files with 10 additions and 7 deletions

View File

@@ -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("")),
],
)
}

View File

@@ -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: '',
},
],
},
},