summaryrefslogtreecommitdiffstats
path: root/src/client/azure_openai.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-04-11 05:03:58 +0800
committerGitHub <noreply@github.com>2024-04-11 05:03:58 +0800
commit3b5843fe2e6b4e3725bbc1b269c23115c953b2b0 (patch)
treea1d2c36dbccf0c82079f774d1efe08c993ee31f2 /src/client/azure_openai.rs
parent01ebc8734838e13fb533022c1d24e7003ed42935 (diff)
downloadaichat-3b5843fe2e6b4e3725bbc1b269c23115c953b2b0.tar.gz
refactor: all clients use openai token counter (#402)
Diffstat (limited to 'src/client/azure_openai.rs')
-rw-r--r--src/client/azure_openai.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/client/azure_openai.rs b/src/client/azure_openai.rs
index e553f3f..3d0cf3f 100644
--- a/src/client/azure_openai.rs
+++ b/src/client/azure_openai.rs
@@ -1,4 +1,4 @@
-use super::openai::{openai_build_body, OPENAI_TOKENS_COUNT_FACTORS};
+use super::openai::openai_build_body;
use super::{AzureOpenAIClient, ExtraConfig, Model, ModelConfig, PromptType, SendData};
use crate::utils::PromptKind;
@@ -45,7 +45,6 @@ impl AzureOpenAIClient {
Model::new(client_name, &v.name)
.set_max_input_tokens(v.max_input_tokens)
.set_capabilities(v.capabilities)
- .set_tokens_count_factors(OPENAI_TOKENS_COUNT_FACTORS)
})
.collect()
}
@@ -54,7 +53,8 @@ impl AzureOpenAIClient {
let api_base = self.get_api_base()?;
let api_key = self.get_api_key()?;
- let body = openai_build_body(data, self.model.name.clone());
+ let mut body = openai_build_body(data, self.model.name.clone());
+ self.model.merge_extra_fields(&mut body);
let url = format!(
"{}/openai/deployments/{}/chat/completions?api-version=2023-05-15",