diff options
| author | sigoden <sigoden@gmail.com> | 2024-05-18 19:06:21 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-18 19:06:21 +0800 |
| commit | b4a40e3fedb438570770a224b890ea24f6e660a9 (patch) | |
| tree | 344b96102da7cbedf1034d023aa82599940388b1 /src/client/vertexai_claude.rs | |
| parent | 1348a62e5f8bc140a7218fbfe1b73f990ab16101 (diff) | |
| download | aichat-b4a40e3fedb438570770a224b890ea24f6e660a9.tar.gz | |
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
Diffstat (limited to 'src/client/vertexai_claude.rs')
| -rw-r--r-- | src/client/vertexai_claude.rs | 8 |
1 files changed, 4 insertions, 4 deletions
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<String>, pub adc_file: Option<String>, #[serde(default)] - pub models: Vec<ModelConfig>, + pub models: Vec<ModelData>, pub extra: Option<ExtraConfig>, } @@ -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<CompletionOutput> { prepare_gcloud_access_token(client, self.name(), &self.config.adc_file).await?; let builder = self.request_builder(client, data)?; claude_send_message(builder).await |
