"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .toolcallstatus import ToolCallStatus
from openrouter.types import BaseModel
from openrouter.utils import validate_open_enum
from pydantic.functional_validators import PlainValidator
from typing import Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


OutputAdvisorServerToolItemType = Literal["openrouter:advisor",]


class OutputAdvisorServerToolItemTypedDict(TypedDict):
    r"""An openrouter:advisor server tool output item"""

    status: ToolCallStatus
    type: OutputAdvisorServerToolItemType
    advice: NotRequired[str]
    r"""The advisor model's response (the advice text returned to the executor)."""
    error: NotRequired[str]
    r"""Error message when the advisor call did not produce advice."""
    id: NotRequired[str]
    instance_name: NotRequired[str]
    r"""Provider-safe function name of the specific advisor instance that produced this item (e.g. `openrouter_advisor__1`). Present only when more than one advisor tool is configured; omitted for the default single advisor. Echo this field back unchanged so the advisor's cross-request memory stays namespaced to the correct instance. This identity is positional: it is derived from the index of the advisor entry in the request `tools` array, so clients must keep the order of advisor tool entries stable across requests in a conversation. Reordering or inserting advisor entries shifts these names and causes each advisor's cross-request memory to be attributed to the wrong instance."""
    model: NotRequired[str]
    r"""Slug of the advisor model that was consulted."""
    prompt: NotRequired[str]
    r"""The prompt the executor sent to the advisor."""


class OutputAdvisorServerToolItem(BaseModel):
    r"""An openrouter:advisor server tool output item"""

    status: Annotated[ToolCallStatus, PlainValidator(validate_open_enum(False))]

    type: OutputAdvisorServerToolItemType

    advice: Optional[str] = None
    r"""The advisor model's response (the advice text returned to the executor)."""

    error: Optional[str] = None
    r"""Error message when the advisor call did not produce advice."""

    id: Optional[str] = None

    instance_name: Optional[str] = None
    r"""Provider-safe function name of the specific advisor instance that produced this item (e.g. `openrouter_advisor__1`). Present only when more than one advisor tool is configured; omitted for the default single advisor. Echo this field back unchanged so the advisor's cross-request memory stays namespaced to the correct instance. This identity is positional: it is derived from the index of the advisor entry in the request `tools` array, so clients must keep the order of advisor tool entries stable across requests in a conversation. Reordering or inserting advisor entries shifts these names and causes each advisor's cross-request memory to be attributed to the wrong instance."""

    model: Optional[str] = None
    r"""Slug of the advisor model that was consulted."""

    prompt: Optional[str] = None
    r"""The prompt the executor sent to the advisor."""
