fix(vision): detect vision-capable custom providers via ProviderProfile flag

_supports_media_in_tool_results() had a hardcoded provider allowlist
that missed custom providers and newer vision-capable providers like
xiaomi. Added ProviderProfile.supports_vision flag and made the
function check:

1. Registered provider profile (supports_vision flag)
2. Model capabilities from models.dev catalog (supports_vision)
3. Existing hardcoded allowlist (unchanged)

This fixes HTTP 400 "text is not set" errors when vision-capable
custom providers receive text-only tool results instead of
multipart image content.

Related: #25594
This commit is contained in:
Kewe63
2026-05-15 16:56:05 +03:00
committed by Teknium
parent 4a4b9bd2dc
commit f736d2be86
3 changed files with 34 additions and 1 deletions

View File

@ -9,6 +9,7 @@ xiaomi = ProviderProfile(
env_vars=("XIAOMI_API_KEY",),
base_url="https://api.xiaomimimo.com/v1",
supports_health_check=False, # /v1/models returns 401 even with valid key
supports_vision=True, # mimo-v2-omni is vision-capable
)
register_provider(xiaomi)