summaryrefslogtreecommitdiffstats
path: root/src/client/ollama.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/ollama.rs
parent01ebc8734838e13fb533022c1d24e7003ed42935 (diff)
downloadaichat-3b5843fe2e6b4e3725bbc1b269c23115c953b2b0.tar.gz
refactor: all clients use openai token counter (#402)
Diffstat (limited to 'src/client/ollama.rs')
-rw-r--r--src/client/ollama.rs6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/client/ollama.rs b/src/client/ollama.rs
index 5ecf6c8..2c51f44 100644
--- a/src/client/ollama.rs
+++ b/src/client/ollama.rs
@@ -1,6 +1,6 @@
use super::{
message::*, patch_system_message, Client, ExtraConfig, Model, ModelConfig, OllamaClient,
- PromptType, SendData, TokensCountFactors,
+ PromptType, SendData,
};
use crate::{render::ReplyHandler, utils::PromptKind};
@@ -12,8 +12,6 @@ use reqwest::{Client as ReqwestClient, RequestBuilder};
use serde::Deserialize;
use serde_json::{json, Value};
-const TOKENS_COUNT_FACTORS: TokensCountFactors = (5, 2);
-
#[derive(Debug, Clone, Deserialize, Default)]
pub struct OllamaConfig {
pub name: Option<String>,
@@ -70,7 +68,6 @@ impl OllamaClient {
.set_capabilities(v.capabilities)
.set_max_input_tokens(v.max_input_tokens)
.set_extra_fields(v.extra_fields.clone())
- .set_tokens_count_factors(TOKENS_COUNT_FACTORS)
})
.collect()
}
@@ -79,7 +76,6 @@ impl OllamaClient {
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 chat_endpoint = self.config.chat_endpoint.as_deref().unwrap_or("/api/chat");