Files
odysseus/tests/test_vision_model_detection.py
Håkon Julius Størholt 91d3511580 Recognize local vision models so their images aren't dropped (#185)
An image attachment only got through if the model name was on a short
built-in list. Anything else was treated as text-only and the image was
quietly dropped, so the model never saw it. That left out a lot of the
smaller vision models you can run locally (moondream was the one I hit).

Pulled the check into is_vision_model() in chat_helpers, broadened it to
cover those, and added a test. Models that already worked are unaffected.

Fixes #124.
2026-06-01 13:09:21 +09:00

31 lines
1.1 KiB
Python

"""Tests for is_vision_model (issue #124).
Local vision models served through Ollama/llama.cpp show up under many
names. If one isn't recognized as vision-capable, the image attachment is
stripped from the request before it reaches the model, so it silently never
sees the picture.
"""
from src.chat_helpers import is_vision_model
def test_recognizes_local_and_hosted_vision_models():
for name in [
# the ones #124 missed
"moondream", "moondream:latest",
"llama3.2-vision:11b", "granite3.2-vision",
"qwen2.5-vl:7b", "qwen2.5vl", "internvl2.5", "cogvlm",
# already worked, keep them working
"llava", "llava:7b", "bakllava", "minicpm-v",
"gpt-4o", "claude-sonnet-4", "gemini-2.0-flash", "pixtral-12b",
]:
assert is_vision_model(name), f"{name!r} should be detected as vision-capable"
def test_text_only_models_not_flagged():
for name in ["qwen2.5:3b", "mistral", "llama3.1:8b", "deepseek-r1", "phi3", "vicuna", ""]:
assert not is_vision_model(name), f"{name!r} should not be flagged as vision"
def test_none_is_safe():
assert is_vision_model(None) is False