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/gemini.rs | |
| parent | 91a06543b24733cf578f3f2d4cb0884e2b18cf2f (diff) | |
| download | aichat-ba3bcfd67c1d6fea5d3d3c5908c975682ee7909b.tar.gz | |
feat: allow patching req body with client config (#534)
Diffstat (limited to 'src/client/gemini.rs')
| -rw-r--r-- | src/client/gemini.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/client/gemini.rs b/src/client/gemini.rs index 1ffb9a9..0d82a48 100644 --- a/src/client/gemini.rs +++ b/src/client/gemini.rs @@ -1,5 +1,7 @@ -use super::vertexai::gemini_build_body; -use super::{ExtraConfig, GeminiClient, Model, ModelData, PromptAction, PromptKind, SendData}; +use super::{ + vertexai::*, Client, ExtraConfig, GeminiClient, Model, ModelData, ModelPatches, PromptAction, + PromptKind, SendData, +}; use anyhow::Result; use reqwest::{Client as ReqwestClient, RequestBuilder}; @@ -15,6 +17,7 @@ pub struct GeminiConfig { pub safety_settings: Option<serde_json::Value>, #[serde(default)] pub models: Vec<ModelData>, + pub patches: Option<ModelPatches>, pub extra: Option<ExtraConfig>, } @@ -32,7 +35,8 @@ impl GeminiClient { false => "generateContent", }; - let body = gemini_build_body(data, &self.model, self.config.safety_settings.clone())?; + let mut body = gemini_build_body(data, &self.model)?; + self.patch_request_body(&mut body); let model = &self.model.name(); |
