language_model: Add supports_tools method to LanguageModel (#27867)

This PR adds a new `supports_tools` method to the `LanguageModel` trait
to indicate whether a given model supports tool use.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers
2025-04-01 19:56:05 +00:00
committed by GitHub
parent 4ff07bf789
commit 5880271b11
12 changed files with 56 additions and 0 deletions
@@ -153,6 +153,10 @@ impl LanguageModel for FakeLanguageModel {
provider_name()
}
fn supports_tools(&self) -> bool {
false
}
fn telemetry_id(&self) -> String {
"fake".to_string()
}
@@ -185,6 +185,9 @@ pub trait LanguageModel: Send + Sync {
LanguageModelAvailability::Public
}
/// Whether this model supports tools.
fn supports_tools(&self) -> bool;
fn tool_input_format(&self) -> LanguageModelToolSchemaFormat {
LanguageModelToolSchemaFormat::JsonSchema
}