From d3cc067c6361158140b7f9033a3bee4527fd15d8 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Fri, 10 Jul 2026 14:56:47 -0500 Subject: [PATCH] Remove hardcoded vision-model allowlist in OllamaModel The OllamaModel.chat() method gated image sending on supports_vision(), which matched model_name against a hardcoded allowlist (llava, bakllava, etc.). Vision-capable models not on the list (e.g. llama3.2-vision) had their images silently dropped and were routed to the text-only chat endpoint, producing labels with no image input. Send images whenever they are provided and remove the unused supports_vision() method and its allowlist. Co-Authored-By: Claude Opus 4.8 --- lars/nepho/models/ollama_model.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lars/nepho/models/ollama_model.py b/lars/nepho/models/ollama_model.py index 8e1f799..f0adcf6 100644 --- a/lars/nepho/models/ollama_model.py +++ b/lars/nepho/models/ollama_model.py @@ -54,7 +54,7 @@ async def chat(self, prompt: str, images: Optional[List[str]] = None) -> str: raise RuntimeError(f"Failed to pull model {self.model_name}") # Prepare the request payload - if images and self.supports_vision(): + if images: # For vision models, encode images as base64 images_data = [] for image_path in images: @@ -104,8 +104,8 @@ async def chat(self, prompt: str, images: Optional[List[str]] = None) -> str: raise RuntimeError(f"Ollama API error: {response.status} - {error_text}") data = await response.json() - - if images and self.supports_vision(): + + if images: return data.get("response", "No response received") else: return data.get("message", {}).get("content", "No response received") @@ -113,11 +113,6 @@ async def chat(self, prompt: str, images: Optional[List[str]] = None) -> str: except Exception as e: raise RuntimeError(f"Error calling Ollama API: {e}") - def supports_vision(self) -> bool: - """Check if this model supports vision capabilities.""" - vision_models = ["llava", "bakllava", "moondream", "minicpm-v", "llava-llama2", "llava-llama3", "llama4:scout"] - return any(vision_model in self.model_name.lower() for vision_model in vision_models) - async def list_available_models(self) -> List[str]: """List all available models in Ollama.""" try: