diff --git a/crates/ollama-api-bindings/src/model.rs b/crates/ollama-api-bindings/src/model.rs index 8b75a72d1a86..55534fdab4d3 100644 --- a/crates/ollama-api-bindings/src/model.rs +++ b/crates/ollama-api-bindings/src/model.rs @@ -44,9 +44,18 @@ impl OllamaModelExt for Ollama { async fn model_available(&self, name: impl AsRef + Send) -> Result { let name = name.as_ref(); - let models_available = self.list_local_models().await?; - - Ok(models_available.into_iter().any(|model| model.name == name)) + let models_available = self.show_model_info(name.into()).await; + + match models_available { + Ok(_) => Ok(true), + Err(err) => { + if err.to_string().contains("not found") { + Ok(false) + } else { + Err(err.into()) + } + } + } } async fn get_first_available_model(&self) -> Result> {