diff options
| author | sigoden <sigoden@gmail.com> | 2024-06-01 17:47:49 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-01 17:47:49 +0800 |
| commit | 571d1022f628cb7d2a3125664bd3293bac4471b5 (patch) | |
| tree | 67034aaf0a656ae9dce0cd0d3aae3605d2ea1767 /src/config | |
| parent | 259583f4f750e4ece7aed07858a9589110d7cf5d (diff) | |
| download | aichat-571d1022f628cb7d2a3125664bd3293bac4471b5.tar.gz | |
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
Diffstat (limited to 'src/config')
| -rw-r--r-- | src/config/input.rs | 10 |
1 files changed, 7 insertions, 3 deletions
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<CompletionData> { + pub fn prepare_completion_data( + &self, + model: &Model, + stream: bool, + ) -> Result<ChatCompletionsData> { 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, |
