From 571d1022f628cb7d2a3125664bd3293bac4471b5 Mon Sep 17 00:00:00 2001 From: sigoden Date: Sat, 1 Jun 2024 17:47:49 +0800 Subject: refactor: rename some client structs and methods (#555) * rename `Completeion*` to `ChatCompletions*` * rename `send_message*` to `chat_completions*` * rename `request_builder` to `chat_completions_builder` * rename `build_body` to `build_chat_completions_body` * rename `extract_completion` to `extract_chat_completions` * format * remove unused config fields --- src/config/input.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/config/input.rs') diff --git a/src/config/input.rs b/src/config/input.rs index 44bbb4b..ae94799 100644 --- a/src/config/input.rs +++ b/src/config/input.rs @@ -1,7 +1,7 @@ use super::{role::Role, session::Session, GlobalConfig}; use crate::client::{ - init_client, list_models, Client, CompletionData, ImageUrl, Message, MessageContent, + init_client, list_models, ChatCompletionsData, Client, ImageUrl, Message, MessageContent, MessageContentPart, MessageRole, Model, }; use crate::function::{ToolCallResult, ToolResults}; @@ -149,7 +149,11 @@ impl Input { init_client(&self.config, Some(self.model())) } - pub fn prepare_completion_data(&self, model: &Model, stream: bool) -> Result { + pub fn prepare_completion_data( + &self, + model: &Model, + stream: bool, + ) -> Result { if !self.medias.is_empty() && !model.supports_vision() { bail!("The current model does not support vision."); } @@ -176,7 +180,7 @@ impl Input { }; functions = config.function.select(function_matcher); }; - Ok(CompletionData { + Ok(ChatCompletionsData { messages, temperature, top_p, -- cgit v1.2.3