mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
fix(providers): Azure OpenAI model listing 404 during configure (#7034)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
@@ -82,11 +82,7 @@ impl ProviderDef for AzureProvider {
|
||||
})?;
|
||||
|
||||
let auth_provider = AzureAuthProvider { auth };
|
||||
let host = format!(
|
||||
"{}/openai/deployments/{}",
|
||||
endpoint.trim_end_matches('/'),
|
||||
deployment_name
|
||||
);
|
||||
let host = format!("{}/openai", endpoint.trim_end_matches('/'));
|
||||
let api_client = ApiClient::new(host, AuthMethod::Custom(Box::new(auth_provider)))?
|
||||
.with_query(vec![("api-version".to_string(), api_version)]);
|
||||
|
||||
@@ -94,6 +90,7 @@ impl ProviderDef for AzureProvider {
|
||||
AZURE_PROVIDER_NAME.to_string(),
|
||||
api_client,
|
||||
model,
|
||||
format!("deployments/{}/", deployment_name),
|
||||
))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -25,14 +25,22 @@ pub struct OpenAiCompatibleProvider {
|
||||
/// Client targeted at the base URL (e.g. `https://api.x.ai/v1`)
|
||||
api_client: ApiClient,
|
||||
model: ModelConfig,
|
||||
/// Path prefix prepended to `chat/completions` (e.g. `"deployments/{name}/"` for Azure).
|
||||
completions_prefix: String,
|
||||
}
|
||||
|
||||
impl OpenAiCompatibleProvider {
|
||||
pub fn new(name: String, api_client: ApiClient, model: ModelConfig) -> Self {
|
||||
pub fn new(
|
||||
name: String,
|
||||
api_client: ApiClient,
|
||||
model: ModelConfig,
|
||||
completions_prefix: String,
|
||||
) -> Self {
|
||||
Self {
|
||||
name,
|
||||
api_client,
|
||||
model,
|
||||
completions_prefix,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,11 +89,12 @@ impl Provider for OpenAiCompatibleProvider {
|
||||
let payload = self.build_request(model_config, system, messages, tools, false)?;
|
||||
let mut log = RequestLog::start(model_config, &payload)?;
|
||||
|
||||
let completions_path = format!("{}chat/completions", self.completions_prefix);
|
||||
let response = self
|
||||
.with_retry(|| async {
|
||||
let resp = self
|
||||
.api_client
|
||||
.response_post(session_id, "chat/completions", &payload)
|
||||
.response_post(session_id, &completions_path, &payload)
|
||||
.await?;
|
||||
handle_response_openai_compat(resp).await
|
||||
})
|
||||
@@ -147,11 +156,12 @@ impl Provider for OpenAiCompatibleProvider {
|
||||
let payload = self.build_request(&self.model, system, messages, tools, true)?;
|
||||
let mut log = RequestLog::start(&self.model, &payload)?;
|
||||
|
||||
let completions_path = format!("{}chat/completions", self.completions_prefix);
|
||||
let response = self
|
||||
.with_retry(|| async {
|
||||
let resp = self
|
||||
.api_client
|
||||
.response_post(Some(session_id), "chat/completions", &payload)
|
||||
.response_post(Some(session_id), &completions_path, &payload)
|
||||
.await?;
|
||||
handle_status_openai_compat(resp).await
|
||||
})
|
||||
|
||||
@@ -65,6 +65,7 @@ impl ProviderDef for XaiProvider {
|
||||
XAI_PROVIDER_NAME.to_string(),
|
||||
api_client,
|
||||
model,
|
||||
String::new(),
|
||||
))
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user