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 15:56:05 -04:00 committed by GitHub
parent 4ff07bf789
commit 5880271b11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 56 additions and 0 deletions

View file

@ -153,6 +153,10 @@ impl LanguageModel for FakeLanguageModel {
provider_name()
}
fn supports_tools(&self) -> bool {
false
}
fn telemetry_id(&self) -> String {
"fake".to_string()
}

View file

@ -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
}