HKUDS/Vibe-Trading · error · RuntimeError

VIBE_TRADING_DEEPSEEK_ADAPTER=native requires langchain-deep

Error message

VIBE_TRADING_DEEPSEEK_ADAPTER=native requires langchain-deepseek

What it means

The DeepSeek provider was explicitly configured to use its native adapter (VIBE_TRADING_DEEPSEEK_ADAPTER=native), but the native adapter construction returned None, meaning langchain-deepseek is unavailable. Because the user demanded native mode, the library refuses to silently fall back to ChatOpenAI.

Source

Thrown at agent/src/providers/llm.py:1453

        return _build_anthropic(
            model=name,
            temperature=temperature,
            callbacks=callbacks,
            effort=get_env_config().llm.langchain_reasoning_effort.strip().lower(),
        )

    if provider == "deepseek":
        adapter_mode = _deepseek_adapter_mode()
        if adapter_mode != "openai-compatible":
            native_llm = _build_native_deepseek(
                model=name,
                temperature=temperature,
                callbacks=callbacks,
            )
            if native_llm is not None:
                return native_llm
            if adapter_mode == "native":
                raise RuntimeError(
                    "VIBE_TRADING_DEEPSEEK_ADAPTER=native requires langchain-deepseek"
                )

    if ChatOpenAI is None:
        raise RuntimeError("langchain-openai is not installed")
    # MiniMax requires temperature in (0.0, 1.0] — clamp to 0.01 when the
    # default 0.0 is used to avoid an API validation error.
    if provider == "minimax" and temperature <= 0.0:
        temperature = 0.01
    # Kimi reasoning models reject any temperature other than 1
    # ("invalid temperature: only 1 is allowed for this model").
    if (
        caps.name in {"moonshot", "kimi-coding"}
        and _KIMI_FORCED_TEMPERATURE_RE.match(name)
        and temperature != 1.0
    ):
        logger.info("Forcing temperature=1.0 for %s (provider requirement)", name)
        temperature = 1.0

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Install langchain-deepseek: pip install langchain-deepseek
  2. Or unset/relax the pin: remove VIBE_TRADING_DEEPSEEK_ADAPTER (or set it to the fallback mode) so the OpenAI-compatible path is used
  3. Verify: python -c "import langchain_deepseek"

Example fix

# before
export VIBE_TRADING_DEEPSEEK_ADAPTER=native
# (langchain-deepseek not installed)

# after
pip install langchain-deepseek
export VIBE_TRADING_DEEPSEEK_ADAPTER=native
Defensive patterns

Strategy: validation

Validate before calling

if os.environ.get('VIBE_TRADING_DEEPSEEK_ADAPTER') == 'native':
    import langchain_deepseek  # raises ImportError early if missing

Prevention

When it happens

Trigger: Setting VIBE_TRADING_DEEPSEEK_ADAPTER=native with provider=deepseek while langchain-deepseek is not installed or fails to import; native adapter build helper returns None for a non-anthropic provider.

Common situations: Opting into the native DeepSeek adapter for newer model support without adding the dependency; a partial upgrade where the adapter module exists but its dependency is missing.

Understand the failure class

Background: "X is not installed. Please install it with pip install Y": missing optional dependency errors — ImportError/ValueError raised when a library's optional extra was never installed — this error's family across 22 libraries.

Related errors


AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28). Data as JSON: /api/errors/d5fd703b81ddf358. Report an issue: GitHub.