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

from __future__ import annotations

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

__all__ = ["BetaResponseCustomToolCallParam", "Agent", "Caller", "CallerDirect", "CallerProgram"]


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"]]


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"]]


Caller: TypeAlias = Union[CallerDirect, CallerProgram]


class BetaResponseCustomToolCallParam(TypedDict, total=False):
    """A call to a custom tool created by the model."""

    call_id: Required[str]
    """An identifier used to map this custom tool call to a tool call output."""

    input: Required[str]
    """The input for the custom tool call generated by the model."""

    name: Required[str]
    """The name of the custom tool being called."""

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

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

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

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

    namespace: str
    """The namespace of the custom tool being called."""
