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/azure_openai.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/client/azure_openai.rs') diff --git a/src/client/azure_openai.rs b/src/client/azure_openai.rs index d586921..95a2960 100644 --- a/src/client/azure_openai.rs +++ b/src/client/azure_openai.rs @@ -1,7 +1,5 @@ use super::openai::openai_build_body; -use super::{ - AzureOpenAIClient, ExtraConfig, Model, ModelConfig, PromptAction, PromptKind, SendData, -}; +use super::{AzureOpenAIClient, ExtraConfig, Model, ModelData, PromptAction, PromptKind, SendData}; use anyhow::Result; use reqwest::{Client as ReqwestClient, RequestBuilder}; @@ -12,7 +10,7 @@ pub struct AzureOpenAIConfig { pub name: Option, pub api_base: Option, pub api_key: Option, - pub models: Vec, + pub models: Vec, pub extra: Option, } @@ -41,7 +39,8 @@ impl AzureOpenAIClient { let url = format!( "{}/openai/deployments/{}/chat/completions?api-version=2024-02-01", - &api_base, self.model.name + &api_base, + self.model.name() ); debug!("AzureOpenAI Request: {url} {body}"); -- cgit v1.2.3