summaryrefslogtreecommitdiffstats
path: root/src/client/cohere.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-05-30 17:10:02 +0800
committerGitHub <noreply@github.com>2024-05-30 17:10:02 +0800
commit54a837784c3df7e73c7c95adfef96e68c842984b (patch)
treee090da40436bd3c1220d5ab88071ac33397ce57c /src/client/cohere.rs
parentfa4bf14e02b1e6361b38014fe6a986738cf06837 (diff)
downloadaichat-54a837784c3df7e73c7c95adfef96e68c842984b.tar.gz
refactor: rename `SendData` to `CompletionData` (#553)
Diffstat (limited to 'src/client/cohere.rs')
-rw-r--r--src/client/cohere.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/client/cohere.rs b/src/client/cohere.rs
index 459c64a..e093778 100644
--- a/src/client/cohere.rs
+++ b/src/client/cohere.rs
@@ -1,7 +1,7 @@
use super::{
catch_error, extract_system_message, json_stream, message::*, Client, CohereClient,
- CompletionOutput, ExtraConfig, Model, ModelData, ModelPatches, PromptAction, PromptKind,
- SendData, SseHandler, ToolCall,
+ CompletionData, CompletionOutput, ExtraConfig, Model, ModelData, ModelPatches, PromptAction,
+ PromptKind, SseHandler, ToolCall,
};
use anyhow::{bail, Result};
@@ -27,7 +27,11 @@ impl CohereClient {
pub const PROMPTS: [PromptAction<'static>; 1] =
[("api_key", "API Key:", true, PromptKind::String)];
- fn request_builder(&self, client: &ReqwestClient, data: SendData) -> Result<RequestBuilder> {
+ fn request_builder(
+ &self,
+ client: &ReqwestClient,
+ data: CompletionData,
+ ) -> Result<RequestBuilder> {
let api_key = self.get_api_key()?;
let mut body = build_body(data, &self.model)?;
@@ -93,8 +97,8 @@ async fn send_message_streaming(builder: RequestBuilder, handler: &mut SseHandle
Ok(())
}
-fn build_body(data: SendData, model: &Model) -> Result<Value> {
- let SendData {
+fn build_body(data: CompletionData, model: &Model) -> Result<Value> {
+ let CompletionData {
mut messages,
temperature,
top_p,