summaryrefslogtreecommitdiffstats
path: root/src/client/azure_openai.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2023-11-03 06:52:57 +0800
committerGitHub <noreply@github.com>2023-11-03 06:52:57 +0800
commitf9c40e52dabda7b037805c0635b84ccb6d75f5a8 (patch)
tree73fda138c432ed18c5f95b7be571f8298f6284c8 /src/client/azure_openai.rs
parentdce6877f5de297803a737387fef7f672593904cf (diff)
downloadaichat-f9c40e52dabda7b037805c0635b84ccb6d75f5a8.tar.gz
refactor: improve code quanity (#203)
- update field name of ModelInfo - rename ModelInfo to Model
Diffstat (limited to 'src/client/azure_openai.rs')
-rw-r--r--src/client/azure_openai.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/client/azure_openai.rs b/src/client/azure_openai.rs
index f8a9dae..d1dc43b 100644
--- a/src/client/azure_openai.rs
+++ b/src/client/azure_openai.rs
@@ -1,5 +1,5 @@
use super::openai::{openai_build_body, OPENAI_TOKENS_COUNT_FACTORS};
-use super::{AzureOpenAIClient, ExtraConfig, PromptType, SendData, ModelInfo};
+use super::{AzureOpenAIClient, ExtraConfig, PromptType, SendData, Model};
use crate::utils::PromptKind;
@@ -42,14 +42,14 @@ impl AzureOpenAIClient {
),
];
- pub fn list_models(local_config: &AzureOpenAIConfig, index: usize) -> Vec<ModelInfo> {
- let client = Self::name(local_config);
+ pub fn list_models(local_config: &AzureOpenAIConfig, client_index: usize) -> Vec<Model> {
+ let client_name = Self::name(local_config);
local_config
.models
.iter()
.map(|v| {
- ModelInfo::new(index, client, &v.name)
+ Model::new(client_index, client_name, &v.name)
.set_max_tokens(v.max_tokens)
.set_tokens_count_factors(OPENAI_TOKENS_COUNT_FACTORS)
})
@@ -70,11 +70,11 @@ impl AzureOpenAIClient {
let api_base = self.get_api_base()?;
- let body = openai_build_body(data, self.model_info.name.clone());
+ let body = openai_build_body(data, self.model.llm_name.clone());
let url = format!(
"{}/openai/deployments/{}/chat/completions?api-version=2023-05-15",
- &api_base, self.model_info.name
+ &api_base, self.model.llm_name
);
let builder = client.post(url).header("api-key", api_key).json(&body);