From ba3bcfd67c1d6fea5d3d3c5908c975682ee7909b Mon Sep 17 00:00:00 2001 From: sigoden Date: Wed, 22 May 2024 21:29:23 +0800 Subject: feat: allow patching req body with client config (#534) --- src/client/gemini.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/client/gemini.rs') 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(default)] pub models: Vec, + pub patches: Option, pub extra: Option, } @@ -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(); -- cgit v1.2.3