Skip to content

Commit

Permalink
feat: no check model's support for function calls (#791)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigoden authored Aug 16, 2024
1 parent 7a95bd5 commit 580ed6b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
4 changes: 0 additions & 4 deletions src/client/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion src/config/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 1 addition & 7 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 580ed6b

Please sign in to comment.