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

from __future__ import annotations

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

__all__ = ["ResponseFunctionToolCallParam", "Caller", "CallerDirect", "CallerProgram"]


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 ResponseFunctionToolCallParam(TypedDict, total=False):
    """A tool call to run a function.

    See the
    [function calling guide](https://platform.openai.com/docs/guides/function-calling) for more information.
    """

    arguments: Required[str]
    """A JSON string of the arguments to pass to the function."""

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

    name: Required[str]
    """The name of the function to run."""

    type: Required[Literal["function_call"]]
    """The type of the function tool call. Always `function_call`."""

    id: str
    """The unique ID of the function tool call."""

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

    namespace: str
    """The namespace of the function to run."""

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