Skip to content
Closed
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
18 changes: 10 additions & 8 deletions backend/windmill-common/src/ai_providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ impl AIProvider {
region: Option<String>,
db: &DB,
) -> Result<String> {
// Resource-level base URL should always take precedence over any provider defaults
// (including global OpenAI Azure overrides).
if let Some(base_url) = resource_base_url {
return Ok(base_url);
}

match self {
AIProvider::OpenAI => {
// Check for Azure base path override
Expand Down Expand Up @@ -71,14 +77,10 @@ impl AIProvider {
AIProvider::Anthropic => Ok("https://api.anthropic.com/v1".to_string()),
AIProvider::Mistral => Ok("https://api.mistral.ai/v1".to_string()),
p @ (AIProvider::CustomAI | AIProvider::AzureOpenAI) => {
if let Some(base_url) = resource_base_url {
Ok(base_url)
} else {
Err(Error::BadRequest(format!(
"{:?} provider requires a base URL in the resource",
p
)))
}
Err(Error::BadRequest(format!(
"{:?} provider requires a base URL in the resource",
p
)))
}
AIProvider::AWSBedrock => Ok(format!(
"https://bedrock-runtime.{}.amazonaws.com",
Expand Down