From b4a40e3fedb438570770a224b890ea24f6e660a9 Mon Sep 17 00:00:00 2001 From: sigoden Date: Sat, 18 May 2024 19:06:21 +0800 Subject: feat: support function calling (#514) * feat: support function calling * fix on Windows OS * implement multi-steps function calling * fix on Windows OS * add error for client not support function calling * refactor message data structure and make claude client supporting function calling * support reuse previous call results * improve error handling for function calling * use prefix `may_` as indicator for `execute` type fucntions --- src/client/vertexai_claude.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/client/vertexai_claude.rs') diff --git a/src/client/vertexai_claude.rs b/src/client/vertexai_claude.rs index 2b5f763..2c51d59 100644 --- a/src/client/vertexai_claude.rs +++ b/src/client/vertexai_claude.rs @@ -2,7 +2,7 @@ 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, CompletionDetails, ExtraConfig, Model, ModelConfig, PromptAction, PromptKind, SendData, + Client, CompletionOutput, ExtraConfig, Model, ModelData, PromptAction, PromptKind, SendData, SseHandler, VertexAIClaudeClient, }; @@ -18,7 +18,7 @@ pub struct VertexAIClaudeConfig { pub location: Option, pub adc_file: Option, #[serde(default)] - pub models: Vec, + pub models: Vec, pub extra: Option, } @@ -39,7 +39,7 @@ impl VertexAIClaudeClient { let base_url = format!("https://{location}-aiplatform.googleapis.com/v1/projects/{project_id}/locations/{location}/publishers"); let url = format!( "{base_url}/anthropic/models/{}:streamRawPredict", - self.model.name + self.model.name() ); let mut body = claude_build_body(data, &self.model)?; @@ -64,7 +64,7 @@ impl Client for VertexAIClaudeClient { &self, client: &ReqwestClient, data: SendData, - ) -> Result<(String, CompletionDetails)> { + ) -> Result { prepare_gcloud_access_token(client, self.name(), &self.config.adc_file).await?; let builder = self.request_builder(client, data)?; claude_send_message(builder).await -- cgit v1.2.3