diff options
| author | sigoden <sigoden@gmail.com> | 2024-05-30 17:10:02 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-30 17:10:02 +0800 |
| commit | 54a837784c3df7e73c7c95adfef96e68c842984b (patch) | |
| tree | e090da40436bd3c1220d5ab88071ac33397ce57c /src/client/replicate.rs | |
| parent | fa4bf14e02b1e6361b38014fe6a986738cf06837 (diff) | |
| download | aichat-54a837784c3df7e73c7c95adfef96e68c842984b.tar.gz | |
refactor: rename `SendData` to `CompletionData` (#553)
Diffstat (limited to 'src/client/replicate.rs')
| -rw-r--r-- | src/client/replicate.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/client/replicate.rs b/src/client/replicate.rs index c39cb07..3b0787a 100644 --- a/src/client/replicate.rs +++ b/src/client/replicate.rs @@ -1,7 +1,7 @@ use super::{ - catch_error, prompt_format::*, sse_stream, Client, CompletionOutput, ExtraConfig, Model, - ModelData, ModelPatches, PromptAction, PromptKind, ReplicateClient, SendData, SseHandler, - SseMmessage, + catch_error, prompt_format::*, sse_stream, Client, CompletionData, CompletionOutput, + ExtraConfig, Model, ModelData, ModelPatches, PromptAction, PromptKind, ReplicateClient, + SseHandler, SseMmessage, }; use anyhow::{anyhow, Result}; @@ -32,7 +32,7 @@ impl ReplicateClient { fn request_builder( &self, client: &ReqwestClient, - data: SendData, + data: CompletionData, api_key: &str, ) -> Result<RequestBuilder> { let mut body = build_body(data, &self.model)?; @@ -55,7 +55,7 @@ impl Client for ReplicateClient { async fn send_message_inner( &self, client: &ReqwestClient, - data: SendData, + data: CompletionData, ) -> Result<CompletionOutput> { let api_key = self.get_api_key()?; let builder = self.request_builder(client, data, &api_key)?; @@ -66,7 +66,7 @@ impl Client for ReplicateClient { &self, client: &ReqwestClient, handler: &mut SseHandler, - data: SendData, + data: CompletionData, ) -> Result<()> { let api_key = self.get_api_key()?; let builder = self.request_builder(client, data, &api_key)?; @@ -135,8 +135,8 @@ async fn send_message_streaming( sse_stream(sse_builder, handle).await } -fn build_body(data: SendData, model: &Model) -> Result<Value> { - let SendData { +fn build_body(data: CompletionData, model: &Model) -> Result<Value> { + let CompletionData { messages, temperature, top_p, |
