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/client/openai_compatible.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/client/openai_compatible.rs') diff --git a/src/client/openai_compatible.rs b/src/client/openai_compatible.rs index f6c0a85..74cd954 100644 --- a/src/client/openai_compatible.rs +++ b/src/client/openai_compatible.rs @@ -1,5 +1,5 @@ use super::{ - openai::*, Client, CompletionData, ExtraConfig, Model, ModelData, ModelPatches, + openai::*, ChatCompletionsData, Client, ExtraConfig, Model, ModelData, ModelPatches, OpenAICompatibleClient, PromptAction, PromptKind, OPENAI_COMPATIBLE_PLATFORMS, }; @@ -36,10 +36,10 @@ impl OpenAICompatibleClient { ), ]; - fn request_builder( + fn chat_completions_builder( &self, client: &ReqwestClient, - data: CompletionData, + data: ChatCompletionsData, ) -> Result { let api_base = match self.get_api_base() { Ok(v) => v, @@ -60,7 +60,7 @@ impl OpenAICompatibleClient { }; let api_key = self.get_api_key().ok(); - let mut body = openai_build_body(data, &self.model); + let mut body = openai_build_chat_completions_body(data, &self.model); self.patch_request_body(&mut body); let chat_endpoint = self @@ -84,6 +84,6 @@ impl OpenAICompatibleClient { impl_client_trait!( OpenAICompatibleClient, - crate::client::openai::openai_send_message, - crate::client::openai::openai_send_message_streaming + crate::client::openai::openai_chat_completions, + crate::client::openai::openai_chat_completions_streaming ); -- cgit v1.2.3