diff options
| author | sigoden <sigoden@gmail.com> | 2024-03-22 19:24:22 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-22 19:24:22 +0800 |
| commit | 527da63d18def9cec29c89387de988b43acb7d24 (patch) | |
| tree | 368286b2ae7dfc374f43ae8829ab1107399d7c83 /src/client/qianwen.rs | |
| parent | 4d52479545082254315171d6716ee9c3588f76f5 (diff) | |
| download | aichat-527da63d18def9cec29c89387de988b43acb7d24.tar.gz | |
refactor: do not automatically convert temperature value (#368)
Diffstat (limited to 'src/client/qianwen.rs')
| -rw-r--r-- | src/client/qianwen.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/client/qianwen.rs b/src/client/qianwen.rs index 1858030..3e69dae 100644 --- a/src/client/qianwen.rs +++ b/src/client/qianwen.rs @@ -1,4 +1,6 @@ -use super::{message::*, Client, ExtraConfig, Model, PromptType, QianwenClient, SendData}; +use super::{ + message::*, Client, ExtraConfig, Model, PromptType, QianwenClient, SendData, TokensCountFactors, +}; use crate::{ render::ReplyHandler, @@ -35,6 +37,8 @@ const MODELS: [(&str, usize, &str); 6] = [ ("qwen-vl-max", 0, "text,vision"), ]; +const TOKENS_COUNT_FACTORS: TokensCountFactors = (4, 14); + #[derive(Debug, Clone, Deserialize, Default)] pub struct QianwenConfig { pub name: Option<String>, @@ -84,6 +88,7 @@ impl QianwenClient { 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() } @@ -221,7 +226,7 @@ fn build_body(data: SendData, model: String, is_vl: bool) -> Result<(Value, bool let mut parameters = json!({}); if let Some(v) = temperature { - parameters["top_k"] = ((v * 50.0).round() as usize).into(); + parameters["temperature"] = v.into(); } (input, parameters) } else { |
