Skip to content

Commit

Permalink
refactor: body data for cohere v2 chat api (#1048)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigoden authored Dec 10, 2024
1 parent 6dbc328 commit 2e7ff29
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/client/cohere.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 2e7ff29

Please sign in to comment.