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 Output Text Param

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

Overview

Concrete TypedDict for constructing text output parameters when sending response data back to the Responses API, provided by the openai-python SDK.

Description

ResponseOutputTextParam is a TypedDict used to serialize a text output from the model for API input. It includes the text content, an annotations iterable (which is a union of AnnotationFileCitation, AnnotationURLCitation, AnnotationContainerFileCitation, and AnnotationFilePath), the literal type field set to "output_text", and an optional logprobs field. The module also defines supporting TypedDicts: AnnotationFileCitation, AnnotationURLCitation, AnnotationContainerFileCitation, AnnotationFilePath, Logprob, and LogprobTopLogprob.

Usage

Import this type when you need to construct typed dictionaries representing text output items to pass as input to subsequent Responses API calls, particularly when managing multi-turn conversation context.

Code Reference

Source Location

Signature

class ResponseOutputTextParam(TypedDict, total=False):
    """A text output from the model."""

    annotations: Required[Iterable[Annotation]]
    text: Required[str]
    type: Required[Literal["output_text"]]
    logprobs: Iterable[Logprob]

Import

from openai.types.responses import ResponseOutputTextParam

I/O Contract

Fields

Name Type Required Description
annotations Iterable[Annotation] Yes The annotations of the text output (file citations, URL citations, container file citations, or file paths).
text str Yes The text output from the model.
type Literal["output_text"] Yes The type of the output text. Always output_text.
logprobs Iterable[Logprob] No Log probabilities of the tokens in the output.

Annotation Union Types

Type Key Fields Description
AnnotationFileCitation file_id, filename, index, type A citation to a file.
AnnotationURLCitation end_index, start_index, title, url, type A citation for a web resource.
AnnotationContainerFileCitation container_id, end_index, file_id, filename, start_index, type A citation for a container file.
AnnotationFilePath file_id, index, type A path to a file.

Usage Examples

from openai.types.responses import ResponseOutputTextParam

text_param: ResponseOutputTextParam = {
    "type": "output_text",
    "text": "According to the report, revenue grew 15%.",
    "annotations": [
        {
            "type": "file_citation",
            "file_id": "file-abc123",
            "filename": "report.pdf",
            "index": 0,
        }
    ],
}

Related Pages

Page Connections

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