summaryrefslogtreecommitdiffstats
path: root/src/client/cohere.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/cohere.rs
parent01ebc8734838e13fb533022c1d24e7003ed42935 (diff)
downloadaichat-3b5843fe2e6b4e3725bbc1b269c23115c953b2b0.tar.gz
refactor: all clients use openai token counter (#402)
Diffstat (limited to 'src/client/cohere.rs')
-rw-r--r--src/client/cohere.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/client/cohere.rs b/src/client/cohere.rs
index a93dc71..6f2e288 100644
--- a/src/client/cohere.rs
+++ b/src/client/cohere.rs
@@ -1,6 +1,6 @@
use super::{
json_stream, message::*, patch_system_message, Client, CohereClient, ExtraConfig, Model,
- PromptType, SendData, TokensCountFactors,
+ PromptType, SendData,
};
use crate::{render::ReplyHandler, utils::PromptKind};
@@ -19,8 +19,6 @@ const MODELS: [(&str, usize, &str); 2] = [
("command-r-plus", 128000, "text"),
];
-const TOKENS_COUNT_FACTORS: TokensCountFactors = (5, 2);
-
#[derive(Debug, Clone, Deserialize, Default)]
pub struct CohereConfig {
pub name: Option<String>,
@@ -62,7 +60,6 @@ impl CohereClient {
Model::new(client_name, name)
.set_capabilities(capabilities.into())
.set_max_input_tokens(Some(max_input_tokens))
- .set_tokens_count_factors(TOKENS_COUNT_FACTORS)
})
.collect()
}
@@ -70,8 +67,7 @@ impl CohereClient {
fn request_builder(&self, client: &ReqwestClient, data: SendData) -> Result<RequestBuilder> {
let api_key = self.get_api_key().ok();
- let mut body = build_body(data, self.model.name.clone())?;
- self.model.merge_extra_fields(&mut body);
+ let body = build_body(data, self.model.name.clone())?;
let url = API_URL;