BerriAI/litellm · error · ValueError

advisor tool definition must include a 'model' field…

Error message

advisor tool definition must include a 'model' field specifying the advisor model

What it means

Error "advisor tool definition must include a 'model' field specifying the advisor model" thrown in BerriAI/litellm.

Solutions

  1. Add a 'model' field to the advisor tool definition naming the advisor model.

When it happens

Trigger: Thrown at litellm/llms/anthropic/experimental_pass_through/messages/interceptors/advisor.py:80 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/e862b38b50aa0e60. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/anthropic/experimental_pass_through/messages/interceptors/advisor.py:80

        stream: bool | None,
        max_tokens: int,
        custom_llm_provider: str | None,
        **kwargs,
    ) -> AnthropicMessagesResponse | AsyncIterator:
        from litellm.llms.anthropic.experimental_pass_through.messages.fake_stream_iterator import (
            FakeAnthropicMessagesStreamIterator,
        )

        # Extract advisor tool config.
        advisor_tool: Final = next(
            (t for t in (tools or []) if t.get("type") == ANTHROPIC_ADVISOR_TOOL_TYPE),
            None,
        )
        if advisor_tool is None:
            raise ValueError(f"handle() called but no {ANTHROPIC_ADVISOR_TOOL_TYPE} tool found in tools list")
        advisor_model: Final[str] = advisor_tool.get("model") or ""
        if not advisor_model:
            raise ValueError("advisor tool definition must include a 'model' field specifying the advisor model")
        _raw_max_uses: Final = advisor_tool.get("max_uses")
        max_uses: Final[int] = ADVISOR_MAX_USES if _raw_max_uses is None else int(_raw_max_uses)
        advisor_api_key, advisor_api_base = _resolve_advisor_credentials(advisor_tool)

        # Build the synthetic tool definition the provider will receive.
        synthetic_advisor_tool: Final = _make_synthetic_advisor_tool()

        # Executor tools = all original tools with advisor replaced by the synthetic one.
        executor_tools: Final[list[dict]] = [
            (synthetic_advisor_tool if t.get("type") == ANTHROPIC_ADVISOR_TOOL_TYPE else t) for t in (tools or [])
        ]

        # Strip prior advisor blocks from history, preserving advice text as context.
        current_messages: list[dict] = strip_advisor_blocks_from_messages(
            [dict(m) for m in messages], replace_with_text=True
        )

        parent_request_id: Final[str] = str(kwargs.pop("litellm_call_id", None) or uuid.uuid4())

View on GitHub (pinned to 77b7c6c40c)