summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-12-10 12:38:42 +0800
committerGitHub <noreply@github.com>2024-12-10 12:38:42 +0800
commit2e7ff29e967dba987d9f238f73dcd87a569d2035 (patch)
treec668e172d4c58598e136bd3e723e2ec3c8eb331e /src
parent6dbc32836a46d16ceace198883a28e5d311b94a5 (diff)
downloadaichat-2e7ff29e967dba987d9f238f73dcd87a569d2035.tar.gz
refactor: body data for cohere v2 chat api (#1048)
Diffstat (limited to 'src')
-rw-r--r--src/client/cohere.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/client/cohere.rs b/src/client/cohere.rs
index 457ea66..5f61454 100644
--- a/src/client/cohere.rs
+++ b/src/client/cohere.rs
@@ -49,7 +49,12 @@ fn prepare_chat_completions(
.unwrap_or_else(|_| API_BASE.to_string());
let url = format!("{}/chat", api_base.trim_end_matches('/'));
- let body = openai_build_chat_completions_body(data, &self_.model);
+ let mut body = openai_build_chat_completions_body(data, &self_.model);
+ if let Some(obj) = body.as_object_mut() {
+ if let Some(top_p) = obj.remove("top_p") {
+ obj.insert("p".to_string(), top_p);
+ }
+ }
let mut request_data = RequestData::new(url, body);