docs(image-gen): align OpenRouter model-resolution docstrings with new precedence

The cherry-picked fix added explicit-kwarg and top-level image_gen.model
resolution but left _resolve_model / _resolve_model_chain docstrings stating
the old 'env override -> config -> DEFAULT_MODEL' order. Document the full
precedence (explicit kwarg -> env -> scoped -> top-level -> default chain) to
match the sibling krea/openai providers.
This commit is contained in:
kshitijk4poor 2026-06-30 19:02:45 +05:30 committed by kshitij
parent 63731fe856
commit 1b3768558e

View file

@ -245,14 +245,19 @@ class OpenRouterCompatImageProvider(ImageGenProvider):
return dict(self._setup_schema)
def _resolve_model(self, explicit: Optional[str] = None) -> str:
"""Pick the image model: env override → config → :data:`DEFAULT_MODEL`."""
"""Pick the image model (first of :meth:`_resolve_model_chain`)."""
return self._resolve_model_chain(explicit)[0]
def _resolve_model_chain(self, explicit: Optional[str] = None) -> list[str]:
"""Ordered model attempts for this request.
Explicit user/model config means "use this exact model", so no fallback.
Without overrides we run the quality-first default chain.
Precedence: explicit caller override (the ``model`` kwarg) the
provider's ``*_IMAGE_MODEL`` env override → scoped
``image_gen.<provider>.model`` top-level ``image_gen.model`` (written
by ``hermes tools``) the quality-first default chain.
Any explicit user/model selection means "use this exact model", so no
fallback. Only the bare default chain carries a Gemini fallback.
"""
if isinstance(explicit, str) and explicit.strip():
return [explicit.strip()]