summaryrefslogtreecommitdiffstats
path: root/src/client/azure_openai.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-06-26 13:48:55 +0800
committerGitHub <noreply@github.com>2024-06-26 13:48:55 +0800
commit2e1dc1f7d58f037e83a184f4c9e662696d1425be (patch)
tree6530c186a24b5a9d0897812675dd0471af7a1ce9 /src/client/azure_openai.rs
parent95bad975f4fb47fe86df1837660a1341009ea12a (diff)
downloadaichat-2e1dc1f7d58f037e83a184f4c9e662696d1425be.tar.gz
refactor: improve azure-openai (#652)
Diffstat (limited to 'src/client/azure_openai.rs')
-rw-r--r--src/client/azure_openai.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/client/azure_openai.rs b/src/client/azure_openai.rs
index 058a53e..e3e9f16 100644
--- a/src/client/azure_openai.rs
+++ b/src/client/azure_openai.rs
@@ -49,7 +49,7 @@ impl AzureOpenAIClient {
self.model.name()
);
- debug!("AzureOpenAI Request: {url} {body}");
+ debug!("AzureOpenAI Chat Completions Request: {url} {body}");
let builder = client.post(url).header("api-key", api_key).json(&body);
@@ -66,9 +66,15 @@ impl AzureOpenAIClient {
let body = openai_build_embeddings_body(data, &self.model);
- let url = format!("{api_base}/embeddings");
+ let url = format!(
+ "{}/openai/deployments/{}/embeddings?api-version=2024-02-01",
+ &api_base,
+ self.model.name()
+ );
+
+ debug!("AzureOpenAI Embeddings Request: {url} {body}");
- let builder = client.post(url).bearer_auth(api_key).json(&body);
+ let builder = client.post(url).header("api-key", api_key).json(&body);
Ok(builder)
}