diff --git a/src/providers/ollama.rs b/src/providers/ollama.rs index 4771050..a3fa779 100644 --- a/src/providers/ollama.rs +++ b/src/providers/ollama.rs @@ -2,7 +2,7 @@ use rig::{ agent::{Agent, AgentBuilder, WithBuilderTools}, client::{CompletionClient as _, Nothing}, completion::Prompt as _, - providers::ollama::{self, CompletionModel}, + providers::ollama::{Client, CompletionModel}, tool::Tool, }; use schemars::JsonSchema; @@ -105,7 +105,16 @@ pub fn builder( temperature: Option, max_tokens: Option, ) -> Result, Error> { - let ollama_client = ollama::Client::new(Nothing)?; + let base_url = std::env::var("OLLAMA_API_BASE_URL").unwrap_or_else(|_| { + #[cfg(feature = "tracing")] + tracing::warn!("OLLAMA_API_BASE_URL not set, using default: http://localhost:11434"); + "http://localhost:11434".to_string() + }); + + let ollama_client = Client::builder() + .api_key(Nothing) + .base_url(&base_url) + .build()?; let builder = ollama_client .agent(model)