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/openai_compatible.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/client/openai_compatible.rs') diff --git a/src/client/openai_compatible.rs b/src/client/openai_compatible.rs index 38b291c..fd101ae 100644 --- a/src/client/openai_compatible.rs +++ b/src/client/openai_compatible.rs @@ -1,8 +1,6 @@ -use crate::client::OPENAI_COMPATIBLE_PLATFORMS; - -use super::openai::openai_build_body; use super::{ - ExtraConfig, Model, ModelData, OpenAICompatibleClient, PromptAction, PromptKind, SendData, + openai::*, Client, ExtraConfig, Model, ModelData, ModelPatches, OpenAICompatibleClient, + PromptAction, PromptKind, SendData, OPENAI_COMPATIBLE_PLATFORMS, }; use anyhow::Result; @@ -17,6 +15,7 @@ pub struct OpenAICompatibleConfig { pub chat_endpoint: Option, #[serde(default)] pub models: Vec, + pub patches: Option, pub extra: Option, } @@ -58,7 +57,7 @@ impl OpenAICompatibleClient { let api_key = self.get_api_key().ok(); let mut body = openai_build_body(data, &self.model); - self.model.merge_extra_fields(&mut body); + self.patch_request_body(&mut body); let chat_endpoint = self .config -- cgit v1.2.3