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/azure_openai.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/client/azure_openai.rs') diff --git a/src/client/azure_openai.rs b/src/client/azure_openai.rs index 95a2960..3779039 100644 --- a/src/client/azure_openai.rs +++ b/src/client/azure_openai.rs @@ -1,5 +1,7 @@ -use super::openai::openai_build_body; -use super::{AzureOpenAIClient, ExtraConfig, Model, ModelData, PromptAction, PromptKind, SendData}; +use super::{ + openai::*, AzureOpenAIClient, Client, ExtraConfig, Model, ModelData, ModelPatches, + PromptAction, PromptKind, SendData, +}; use anyhow::Result; use reqwest::{Client as ReqwestClient, RequestBuilder}; @@ -11,6 +13,7 @@ pub struct AzureOpenAIConfig { pub api_base: Option, pub api_key: Option, pub models: Vec, + pub patches: Option, pub extra: Option, } @@ -35,7 +38,7 @@ impl AzureOpenAIClient { let api_key = self.get_api_key()?; let mut body = openai_build_body(data, &self.model); - self.model.merge_extra_fields(&mut body); + self.patch_request_body(&mut body); let url = format!( "{}/openai/deployments/{}/chat/completions?api-version=2024-02-01", -- cgit v1.2.3