fix(vision): drop models.dev catalog fallback, keep explicit profile flag

The models.dev supports_vision field reflects model IMAGE-INPUT capability,
which is not the same contract as 'provider API accepts images inside
tool-result messages' — the looser heuristic could re-introduce the exact
HTTP 400 'text is not set' it aims to fix. Keep only the explicit, opt-in
ProviderProfile.supports_vision flag (set on xiaomi); add catalog-based
detection later if a concrete provider needs it.
This commit is contained in:
teknium1
2026-06-04 17:31:51 -07:00
committed by Teknium
parent f736d2be86
commit d33d23c852

View File

@ -541,8 +541,7 @@ def _supports_media_in_tool_results(provider: str, model: str) -> bool:
For unknown / legacy providers we conservatively return False — the
caller falls back to the legacy aux-LLM text path. The check is relaxed
when the provider's ``ProviderProfile`` declares ``supports_vision=True``
or when ``get_model_capabilities`` reports vision support for the model.
when the provider's ``ProviderProfile`` declares ``supports_vision=True``.
"""
if not isinstance(provider, str):
return False
@ -590,16 +589,6 @@ def _supports_media_in_tool_results(provider: str, model: str) -> bool:
except Exception:
pass
# Check model capabilities from the models.dev catalog as a final
# fallback for custom providers whose models happen to be registered.
try:
from agent.models_dev import get_model_capabilities
caps = get_model_capabilities(provider, model)
if caps is not None and bool(getattr(caps, "supports_vision", False)):
return True
except Exception:
pass
# Other vision-capable provider stacks. Conservative default: False.
# Add explicit entries here as we verify each provider's tool-result
# multimodal support empirically.