summaryrefslogtreecommitdiffstats
path: root/src/client/vertexai.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/vertexai.rs')
-rw-r--r--src/client/vertexai.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/client/vertexai.rs b/src/client/vertexai.rs
index 1abbffc..102b5cb 100644
--- a/src/client/vertexai.rs
+++ b/src/client/vertexai.rs
@@ -1,7 +1,7 @@
use super::{
access_token::*, catch_error, json_stream, message::*, patch_system_message, Client,
- CompletionOutput, ExtraConfig, Model, ModelData, ModelPatches, PromptAction, PromptKind,
- SendData, SseHandler, ToolCall, VertexAIClient,
+ CompletionData, CompletionOutput, ExtraConfig, Model, ModelData, ModelPatches, PromptAction,
+ PromptKind, SseHandler, ToolCall, VertexAIClient,
};
use anyhow::{anyhow, bail, Context, Result};
@@ -35,7 +35,11 @@ impl VertexAIClient {
("location", "Location", true, PromptKind::String),
];
- fn request_builder(&self, client: &ReqwestClient, data: SendData) -> Result<RequestBuilder> {
+ fn request_builder(
+ &self,
+ client: &ReqwestClient,
+ data: CompletionData,
+ ) -> Result<RequestBuilder> {
let project_id = self.get_project_id()?;
let location = self.get_location()?;
let access_token = get_access_token(self.name())?;
@@ -66,7 +70,7 @@ impl Client for VertexAIClient {
async fn send_message_inner(
&self,
client: &ReqwestClient,
- data: SendData,
+ data: CompletionData,
) -> Result<CompletionOutput> {
prepare_gcloud_access_token(client, self.name(), &self.config.adc_file).await?;
let builder = self.request_builder(client, data)?;
@@ -77,7 +81,7 @@ impl Client for VertexAIClient {
&self,
client: &ReqwestClient,
handler: &mut SseHandler,
- data: SendData,
+ data: CompletionData,
) -> Result<()> {
prepare_gcloud_access_token(client, self.name(), &self.config.adc_file).await?;
let builder = self.request_builder(client, data)?;
@@ -177,8 +181,8 @@ fn gemini_extract_completion_text(data: &Value) -> Result<CompletionOutput> {
Ok(output)
}
-pub(crate) fn gemini_build_body(data: SendData, model: &Model) -> Result<Value> {
- let SendData {
+pub(crate) fn gemini_build_body(data: CompletionData, model: &Model) -> Result<Value> {
+ let CompletionData {
mut messages,
temperature,
top_p,