summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-08-16 18:44:13 +0800
committerGitHub <noreply@github.com>2024-08-16 18:44:13 +0800
commit580ed6bea370345f76ca69ecb4c1cc30afa689c5 (patch)
tree9a324075b6186abd4b07f8f34a4e396298f1e48a
parent7a95bd5de0751a87caed7376b92071f58dc41861 (diff)
downloadaichat-580ed6bea370345f76ca69ecb4c1cc30afa689c5.tar.gz
feat: no check model's support for function calls (#791)
-rw-r--r--src/client/model.rs4
-rw-r--r--src/config/input.rs2
-rw-r--r--src/config/mod.rs8
3 files changed, 2 insertions, 12 deletions
diff --git a/src/client/model.rs b/src/client/model.rs
index 17646c9..bea96a2 100644
--- a/src/client/model.rs
+++ b/src/client/model.rs
@@ -187,10 +187,6 @@ impl Model {
self.data.supports_vision
}
- pub fn supports_function_calling(&self) -> bool {
- self.data.supports_function_calling
- }
-
pub fn default_chunk_size(&self) -> usize {
self.data.default_chunk_size.unwrap_or(1000)
}
diff --git a/src/config/input.rs b/src/config/input.rs
index fe1da51..dd68749 100644
--- a/src/config/input.rs
+++ b/src/config/input.rs
@@ -212,7 +212,7 @@ impl Input {
model.guard_max_input_tokens(&messages)?;
let temperature = self.role().temperature();
let top_p = self.role().top_p();
- let functions = self.config.read().select_functions(model, self.role());
+ let functions = self.config.read().select_functions(self.role());
Ok(ChatCompletionsData {
messages,
temperature,
diff --git a/src/config/mod.rs b/src/config/mod.rs
index 9fb2b77..508b768 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -1116,7 +1116,7 @@ impl Config {
Ok(())
}
- pub fn select_functions(&self, model: &Model, role: &Role) -> Option<Vec<FunctionDeclaration>> {
+ pub fn select_functions(&self, role: &Role) -> Option<Vec<FunctionDeclaration>> {
let mut functions = vec![];
if self.function_calling {
if let Some(use_tools) = role.use_tools() {
@@ -1176,12 +1176,6 @@ impl Config {
);
functions = agent_functions;
}
- if !functions.is_empty() && !model.supports_function_calling() {
- functions.clear();
- if *IS_STDOUT_TERMINAL {
- eprintln!("{}", warning_text("WARNING: This LLM or client does not support function calling, despite the context requiring it."));
- }
- }
};
if functions.is_empty() {
None