diff options
| author | sigoden <sigoden@gmail.com> | 2024-05-22 21:29:23 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-22 21:29:23 +0800 |
| commit | ba3bcfd67c1d6fea5d3d3c5908c975682ee7909b (patch) | |
| tree | 29811c719f131f946cd37634507885ee8c63534d /src/client/cohere.rs | |
| parent | 91a06543b24733cf578f3f2d4cb0884e2b18cf2f (diff) | |
| download | aichat-ba3bcfd67c1d6fea5d3d3c5908c975682ee7909b.tar.gz | |
feat: allow patching req body with client config (#534)
Diffstat (limited to 'src/client/cohere.rs')
| -rw-r--r-- | src/client/cohere.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/client/cohere.rs b/src/client/cohere.rs index 41b0e4b..459c64a 100644 --- a/src/client/cohere.rs +++ b/src/client/cohere.rs @@ -1,6 +1,7 @@ use super::{ - catch_error, extract_system_message, json_stream, message::*, CohereClient, CompletionOutput, - ExtraConfig, Model, ModelData, PromptAction, PromptKind, SendData, SseHandler, ToolCall, + catch_error, extract_system_message, json_stream, message::*, Client, CohereClient, + CompletionOutput, ExtraConfig, Model, ModelData, ModelPatches, PromptAction, PromptKind, + SendData, SseHandler, ToolCall, }; use anyhow::{bail, Result}; @@ -16,6 +17,7 @@ pub struct CohereConfig { pub api_key: Option<String>, #[serde(default)] pub models: Vec<ModelData>, + pub patches: Option<ModelPatches>, pub extra: Option<ExtraConfig>, } @@ -28,7 +30,8 @@ impl CohereClient { fn request_builder(&self, client: &ReqwestClient, data: SendData) -> Result<RequestBuilder> { let api_key = self.get_api_key()?; - let body = build_body(data, &self.model)?; + let mut body = build_body(data, &self.model)?; + self.patch_request_body(&mut body); let url = API_URL; |
