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/openai_compatible.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/client/openai_compatible.rs') diff --git a/src/client/openai_compatible.rs b/src/client/openai_compatible.rs index 6eae77b..38b291c 100644 --- a/src/client/openai_compatible.rs +++ b/src/client/openai_compatible.rs @@ -2,7 +2,7 @@ use crate::client::OPENAI_COMPATIBLE_PLATFORMS; use super::openai::openai_build_body; use super::{ - ExtraConfig, Model, ModelConfig, OpenAICompatibleClient, PromptAction, PromptKind, SendData, + ExtraConfig, Model, ModelData, OpenAICompatibleClient, PromptAction, PromptKind, SendData, }; use anyhow::Result; @@ -16,7 +16,7 @@ pub struct OpenAICompatibleConfig { pub api_key: Option, pub chat_endpoint: Option, #[serde(default)] - pub models: Vec, + pub models: Vec, pub extra: Option, } @@ -44,7 +44,7 @@ impl OpenAICompatibleClient { match OPENAI_COMPATIBLE_PLATFORMS .into_iter() .find_map(|(name, api_base)| { - if name == self.model.client_name { + if name == self.model.client_name() { Some(api_base.to_string()) } else { None -- cgit v1.2.3