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/client/openai_compatible.rs | |
| 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/client/openai_compatible.rs')
| -rw-r--r-- | src/client/openai_compatible.rs | 12 |
1 files changed, 6 insertions, 6 deletions
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<RequestBuilder> { 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 ); |
