Improve Ollama tool use (#30120)
<img width="458" alt="Screenshot 2025-05-07 at 9 37 39 AM" src="https://github.com/user-attachments/assets/80f8a9b8-6a13-4e84-b91d-140e11475638" /> <img width="603" alt="Screenshot 2025-05-07 at 9 37 33 AM" src="https://github.com/user-attachments/assets/7fe67a68-3885-4a0e-a282-aad37e92068b" /> Release Notes: - Ollama models no longer require the supports_tools field in settings (defaults to false) --------- Co-authored-by: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
parent
0a44048af8
commit
fcb9706022
4 changed files with 44 additions and 39 deletions
|
@ -52,7 +52,7 @@ pub struct AvailableModel {
|
|||
/// The number of seconds to keep the connection open after the last request
|
||||
pub keep_alive: Option<KeepAlive>,
|
||||
/// Whether the model supports tools
|
||||
pub supports_tools: bool,
|
||||
pub supports_tools: Option<bool>,
|
||||
}
|
||||
|
||||
pub struct OllamaLanguageModelProvider {
|
||||
|
@ -93,8 +93,12 @@ impl State {
|
|||
async move {
|
||||
let name = model.name.as_str();
|
||||
let capabilities = show_model(http_client.as_ref(), &api_url, name).await?;
|
||||
let ollama_model =
|
||||
ollama::Model::new(name, None, None, capabilities.supports_tools());
|
||||
let ollama_model = ollama::Model::new(
|
||||
name,
|
||||
None,
|
||||
None,
|
||||
Some(capabilities.supports_tools()),
|
||||
);
|
||||
Ok(ollama_model)
|
||||
}
|
||||
});
|
||||
|
@ -317,7 +321,7 @@ impl LanguageModel for OllamaLanguageModel {
|
|||
}
|
||||
|
||||
fn supports_tools(&self) -> bool {
|
||||
self.model.supports_tools
|
||||
self.model.supports_tools.unwrap_or(false)
|
||||
}
|
||||
|
||||
fn telemetry_id(&self) -> String {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue