fix(models): prefer image modalities for vision routing
This commit is contained in:
@@ -223,6 +223,13 @@ CAPS_REGISTRY = {
|
||||
"tool_call": True,
|
||||
"limit": {"context": 32000, "output": 8192},
|
||||
},
|
||||
"text-only-with-stale-attachment": {
|
||||
"id": "text-only-with-stale-attachment",
|
||||
"attachment": True,
|
||||
"tool_call": True,
|
||||
"modalities": {"input": ["text"]},
|
||||
"limit": {"context": 128000, "output": 8192},
|
||||
},
|
||||
},
|
||||
},
|
||||
"anthropic": {
|
||||
@@ -243,7 +250,7 @@ class TestGetModelCapabilities:
|
||||
"""Tests for get_model_capabilities vision detection."""
|
||||
|
||||
def test_vision_from_attachment_flag(self):
|
||||
"""Models with attachment=True should report supports_vision=True."""
|
||||
"""Models with attachment=True and no modalities should report supports_vision=True."""
|
||||
with patch("agent.models_dev.fetch_models_dev", return_value=CAPS_REGISTRY):
|
||||
caps = get_model_capabilities("anthropic", "claude-sonnet-4")
|
||||
assert caps is not None
|
||||
@@ -257,6 +264,13 @@ class TestGetModelCapabilities:
|
||||
assert caps is not None
|
||||
assert caps.supports_vision is True
|
||||
|
||||
def test_text_only_modalities_override_stale_attachment_flag(self):
|
||||
"""Text-only modalities must win over stale attachment=True metadata."""
|
||||
with patch("agent.models_dev.fetch_models_dev", return_value=CAPS_REGISTRY):
|
||||
caps = get_model_capabilities("google", "text-only-with-stale-attachment")
|
||||
assert caps is not None
|
||||
assert caps.supports_vision is False
|
||||
|
||||
def test_no_vision_without_attachment_or_modalities(self):
|
||||
"""Models with neither attachment nor image modality should be non-vision."""
|
||||
with patch("agent.models_dev.fetch_models_dev", return_value=CAPS_REGISTRY):
|
||||
|
||||
Reference in New Issue
Block a user