Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Openai Openai python Response Function Tool Call Output

From Leeroopedia
Knowledge Sources
Domains API_Types, Responses_API
Last Updated 2026-02-15 00:00 GMT

Overview

Concrete type for representing the output of a function tool call provided by the openai-python SDK.

Description

ResponseFunctionToolCallOutputItem is a Pydantic model representing the result returned after executing a function tool call. It carries the id of the output item, the call_id linking it back to the originating function call, and the output which can be either a plain string or a list of mixed content items (text, image, or file). The type field is always "function_call_output". An optional status field indicates the progress of the item. The module also exports OutputOutputContentList, a discriminated union type alias for the content list variant.

Usage

Import this type when you need to construct function call output items to feed back into a multi-turn Responses API conversation, or when type-checking output items from a response.

Code Reference

Source Location

Signature

OutputOutputContentList: TypeAlias = Annotated[
    Union[ResponseInputText, ResponseInputImage, ResponseInputFile],
    PropertyInfo(discriminator="type"),
]

class ResponseFunctionToolCallOutputItem(BaseModel):
    id: str
    call_id: str
    output: Union[str, List[OutputOutputContentList]]
    type: Literal["function_call_output"]
    status: Optional[Literal["in_progress", "completed", "incomplete"]] = None

Import

from openai.types.responses import ResponseFunctionToolCallOutputItem

I/O Contract

Fields

Name Type Required Description
id str Yes The unique ID of the function call tool output.
call_id str Yes The unique ID of the function tool call generated by the model.
output Union[str, List[OutputOutputContentList]] Yes The output from the function call. Can be a string or a list of content items.
type Literal["function_call_output"] Yes The type of the function tool call output. Always function_call_output.
status Optional[Literal["in_progress", "completed", "incomplete"]] No The status of the item. Populated when items are returned via API.

Usage Examples

import openai

client = openai.OpenAI()

# After receiving a function_call in a response, supply the output:
response = client.responses.create(
    model="gpt-4o",
    input=[
        {"role": "user", "content": "What is the weather in Boston?"},
        {
            "type": "function_call",
            "name": "get_weather",
            "call_id": "call_abc123",
            "arguments": '{"location": "Boston"}',
        },
        {
            "type": "function_call_output",
            "call_id": "call_abc123",
            "output": '{"temperature": "72F", "conditions": "sunny"}',
        },
    ],
)
print(response.output_text)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment