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

from __future__ import annotations

from typing import Union, Iterable, Optional
from typing_extensions import Literal, Required, TypeAlias, TypedDict

from .beta_response_input_file_param import BetaResponseInputFileParam
from .beta_response_input_text_param import BetaResponseInputTextParam
from .beta_response_input_image_param import BetaResponseInputImageParam

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

OutputOutputContentList: TypeAlias = Union[
    BetaResponseInputTextParam, BetaResponseInputImageParam, BetaResponseInputFileParam
]


class Agent(TypedDict, total=False):
    """The agent that produced this item."""

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


class CallerDirect(TypedDict, total=False):
    type: Required[Literal["direct"]]
    """The caller type. Always `direct`."""


class CallerProgram(TypedDict, total=False):
    caller_id: Required[str]
    """The call ID of the program item that produced this tool call."""

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


Caller: TypeAlias = Union[CallerDirect, CallerProgram]


class BetaResponseCustomToolCallOutputParam(TypedDict, total=False):
    """The output of a custom tool call from your code, being sent back to the model."""

    call_id: Required[str]
    """The call ID, used to map this custom tool call output to a custom tool call."""

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

    type: Required[Literal["custom_tool_call_output"]]
    """The type of the custom tool call output. Always `custom_tool_call_output`."""

    id: str
    """The unique ID of the custom tool call output in the OpenAI platform."""

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

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