diff options
| author | sigoden <sigoden@gmail.com> | 2023-11-02 07:08:54 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-02 07:08:54 +0800 |
| commit | 5c7bfd92ff3e557477969be9db0638ef0d3d3659 (patch) | |
| tree | dc626111b7e7f9aa1a3c4b90aab22468d61e226f /src/client/azure_openai.rs | |
| parent | 0238c8734ecadfc6172fdded0fbcf83949b198fa (diff) | |
| download | aichat-5c7bfd92ff3e557477969be9db0638ef0d3d3659.tar.gz | |
refactor: set tokens count factors (#195)
Diffstat (limited to 'src/client/azure_openai.rs')
| -rw-r--r-- | src/client/azure_openai.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/client/azure_openai.rs b/src/client/azure_openai.rs index 3a48145..5603666 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_formula}; +use super::openai::{openai_build_body, OPENAI_TOKENS_COUNT_FACTORS}; use super::{AzureOpenAIClient, ExtraConfig, ModelInfo, PromptKind, PromptType, SendData}; use anyhow::{anyhow, Result}; @@ -46,7 +46,11 @@ impl AzureOpenAIClient { local_config .models .iter() - .map(|v| openai_tokens_formula(ModelInfo::new(index, client, &v.name).set_max_tokens(v.max_tokens))) + .map(|v| { + ModelInfo::new(index, client, &v.name) + .set_max_tokens(v.max_tokens) + .set_tokens_count_factors(OPENAI_TOKENS_COUNT_FACTORS) + }) .collect() } |
