summaryrefslogtreecommitdiffstats
path: root/src/client/vertexai_claude.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-05-22 21:29:23 +0800
committerGitHub <noreply@github.com>2024-05-22 21:29:23 +0800
commitba3bcfd67c1d6fea5d3d3c5908c975682ee7909b (patch)
tree29811c719f131f946cd37634507885ee8c63534d /src/client/vertexai_claude.rs
parent91a06543b24733cf578f3f2d4cb0884e2b18cf2f (diff)
downloadaichat-ba3bcfd67c1d6fea5d3d3c5908c975682ee7909b.tar.gz
feat: allow patching req body with client config (#534)
Diffstat (limited to 'src/client/vertexai_claude.rs')
-rw-r--r--src/client/vertexai_claude.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/client/vertexai_claude.rs b/src/client/vertexai_claude.rs
index 2c51d59..6420611 100644
--- a/src/client/vertexai_claude.rs
+++ b/src/client/vertexai_claude.rs
@@ -1,9 +1,6 @@
-use super::access_token::*;
-use super::claude::{claude_build_body, claude_send_message, claude_send_message_streaming};
-use super::vertexai::prepare_gcloud_access_token;
use super::{
- Client, CompletionOutput, ExtraConfig, Model, ModelData, PromptAction, PromptKind, SendData,
- SseHandler, VertexAIClaudeClient,
+ access_token::*, claude::*, vertexai::*, Client, CompletionOutput, ExtraConfig, Model,
+ ModelData, ModelPatches, PromptAction, PromptKind, SendData, SseHandler, VertexAIClaudeClient,
};
use anyhow::Result;
@@ -19,6 +16,7 @@ pub struct VertexAIClaudeConfig {
pub adc_file: Option<String>,
#[serde(default)]
pub models: Vec<ModelData>,
+ pub patches: Option<ModelPatches>,
pub extra: Option<ExtraConfig>,
}
@@ -43,6 +41,7 @@ impl VertexAIClaudeClient {
);
let mut body = claude_build_body(data, &self.model)?;
+ self.patch_request_body(&mut body);
if let Some(body_obj) = body.as_object_mut() {
body_obj.remove("model");
}