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")
|
.get_param("AZURE_OPENAI_API_VERSION")
|
||||||
.unwrap_or_else(|_| AZURE_DEFAULT_API_VERSION.to_string());
|
.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
|
||||||
let api_key = config.get_secret("AZURE_OPENAI_API_KEY").ok();
|
.get_secret("AZURE_OPENAI_API_KEY")
|
||||||
|
.ok()
|
||||||
|
.filter(|key: &String| !key.is_empty());
|
||||||
let auth = AzureAuth::new(api_key)?;
|
let auth = AzureAuth::new(api_key)?;
|
||||||
|
|
||||||
let client = Client::builder()
|
let client = Client::builder()
|
||||||
@@ -227,6 +229,7 @@ impl Provider for AzureProvider {
|
|||||||
ConfigKey::new("AZURE_OPENAI_ENDPOINT", true, false, None),
|
ConfigKey::new("AZURE_OPENAI_ENDPOINT", true, false, None),
|
||||||
ConfigKey::new("AZURE_OPENAI_DEPLOYMENT_NAME", 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_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:
|
description:
|
||||||
'Access Azure OpenAI models using API key or Azure credentials. If no API key is provided, Azure credential chain will be used.',
|
'Access Azure OpenAI models using API key or Azure credentials. If no API key is provided, Azure credential chain will be used.',
|
||||||
parameters: [
|
parameters: [
|
||||||
{
|
|
||||||
name: 'AZURE_OPENAI_API_KEY',
|
|
||||||
is_secret: true,
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'AZURE_OPENAI_ENDPOINT',
|
name: 'AZURE_OPENAI_ENDPOINT',
|
||||||
is_secret: false,
|
is_secret: false,
|
||||||
@@ -213,6 +208,11 @@ export const PROVIDER_REGISTRY: ProviderRegistry[] = [
|
|||||||
is_secret: false,
|
is_secret: false,
|
||||||
default: '2024-10-21',
|
default: '2024-10-21',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'AZURE_OPENAI_API_KEY',
|
||||||
|
is_secret: true,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user