added check for api key version, and only modify url if we have api key set

This commit is contained in:
Hitesh Joshi
2025-04-27 16:03:55 +05:30
parent 8f5ecd27be
commit 20687654ff

View File

@ -141,12 +141,12 @@ impl OpenAIClient {
} }
async fn build_request(&self, method: Method, path: &str) -> reqwest::RequestBuilder { async fn build_request(&self, method: Method, path: &str) -> reqwest::RequestBuilder {
let url = format!( let mut url = format!("{}/{}", self.api_endpoint, path);
"{}/{}?api-version={}",
self.api_endpoint, if self.api_version.is_some() {
path, let api_version = self.api_version.as_ref().unwrap();
self.api_version.as_deref().unwrap_or("v1") url = format!("{}?api-version={}", url, api_version);
); }
let client = Client::builder(); let client = Client::builder();