# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Union, Optional
from typing_extensions import Literal, Annotated, TypeAlias

from ..._utils import PropertyInfo
from ..._models import BaseModel
from .beta_response_input_file import BetaResponseInputFile
from .beta_response_input_text import BetaResponseInputText
from .beta_response_input_image import BetaResponseInputImage

__all__ = [
    "BetaResponseFunctionToolCallOutputItem",
    "OutputOutputContentList",
    "Agent",
    "Caller",
    "CallerDirect",
    "CallerProgram",
]

OutputOutputContentList: TypeAlias = Annotated[
    Union[BetaResponseInputText, BetaResponseInputImage, BetaResponseInputFile], PropertyInfo(discriminator="type")
]


class Agent(BaseModel):
    """The agent that produced this item."""

    agent_name: str
    """The canonical name of the agent that produced this item."""


class CallerDirect(BaseModel):
    type: Literal["direct"]
    """The caller type. Always `direct`."""


class CallerProgram(BaseModel):
    caller_id: str
    """The call ID of the program item that produced this tool call."""

    type: Literal["program"]
    """The caller type. Always `program`."""


Caller: TypeAlias = Annotated[Union[CallerDirect, CallerProgram, None], PropertyInfo(discriminator="type")]


class BetaResponseFunctionToolCallOutputItem(BaseModel):
    id: str
    """The unique ID of the function call tool output."""

    call_id: str
    """The unique ID of the function tool call generated by the model."""

    output: Union[str, List[OutputOutputContentList]]
    """
    The output from the function call generated by your code. Can be a string or an
    list of output content.
    """

    status: Literal["in_progress", "completed", "incomplete"]
    """The status of the item.

    One of `in_progress`, `completed`, or `incomplete`. Populated when items are
    returned via API.
    """

    type: Literal["function_call_output"]
    """The type of the function tool call output. Always `function_call_output`."""

    agent: Optional[Agent] = None
    """The agent that produced this item."""

    caller: Optional[Caller] = None
    """The execution context that produced this tool call."""

    created_by: Optional[str] = None
    """The identifier of the actor that created the item."""

    name: Optional[str] = None
    """The name of the tool that produced the output."""

    namespace: Optional[str] = None
    """The namespace of the tool that produced the output."""
