ZhuLinsen/daily_stock_analysis · error · ValueError

Hermes Vision 未验证:VISION_MODEL 不能选择包含 Hermes deployment 的 ro

Error message

Hermes Vision 未验证:VISION_MODEL 不能选择包含 Hermes deployment 的 route。

What it means

Error "Hermes Vision 未验证:VISION_MODEL 不能选择包含 Hermes deployment 的 route。" thrown in ZhuLinsen/daily_stock_analysis.

Source

Thrown at src/services/image_stock_extractor.py:278

def _deployment_allows_empty_api_key(deployment: Dict[str, Any]) -> bool:
    """Return whether a configured vision deployment is a supported keyless endpoint."""
    params = deployment.get("litellm_params") or {}
    if str(params.get("api_key") or "").strip():
        return False
    wire_model = str(params.get("model") or "").strip()
    protocol = wire_model.split("/", 1)[0] if "/" in wire_model else None
    return channel_allows_empty_api_key(protocol, params.get("api_base"))


def _call_litellm_vision(image_b64: str, mime_type: str, api_key: Optional[str] = None) -> str:
    """Extract stock codes from an image using litellm (all providers via OpenAI vision format)."""
    global litellm
    cfg = get_config()
    model = _resolve_vision_model()
    if not model:
        raise ValueError("未配置 Vision API。请设置 LITELLM_MODEL 或相关 API Key。")
    if route_has_hermes(getattr(cfg, "llm_model_list", []) or [], model):
        raise ValueError("Hermes Vision 未验证:VISION_MODEL 不能选择包含 Hermes deployment 的 route。")

    deployments = _matching_vision_deployments(model, cfg)
    keys = _get_api_keys_for_model(model, cfg)
    key = api_key if api_key and api_key in keys else (random.choice(keys) if keys else None)

    deployment_params: Dict[str, Any] = {}
    if deployments:
        deployment = next(
            (
                item
                for item in deployments
                if str((item.get("litellm_params") or {}).get("api_key") or "").strip() == key
            ),
            None,
        )
        if deployment is None:
            deployment = next(
                (item for item in deployments if _deployment_allows_empty_api_key(item)),

View on GitHub (pinned to 5159bd72e8)

Solutions

  1. Set VISION_MODEL to a non-Hermes route (e.g. a standard openai/<model> route) for image extraction.
  2. Pick a verified vision-capable model that does not route through a Hermes deployment.
  3. Update .env and restart after changing VISION_MODEL.

When it happens

Trigger: Thrown at src/services/image_stock_extractor.py:278 when the library encounters an invalid state.

Common situations: Raised when VISION_MODEL is routed to an unverified Hermes deployment; occurs when the configured vision route includes a Hermes backend that has not passed verification.


AI-assisted analysis of ZhuLinsen/daily_stock_analysis@5159bd72e8 (2026-08-15). Data as JSON: /api/errors/ce1c6ce4d7caf36e. Report an issue: GitHub.