From 3b5843fe2e6b4e3725bbc1b269c23115c953b2b0 Mon Sep 17 00:00:00 2001 From: sigoden Date: Thu, 11 Apr 2024 05:03:58 +0800 Subject: refactor: all clients use openai token counter (#402) --- src/client/ollama.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/client/ollama.rs') 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, @@ -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"); -- cgit v1.2.3