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 Text Config

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

Overview

Concrete type for representing text response configuration options returned by the Responses API, provided by the openai-python SDK.

Description

ResponseTextConfig is a Pydantic model that describes configuration options for a text response from the model. It supports both plain text and structured JSON data output. The model has an optional format field of type ResponseFormatTextConfig (which can specify text, json_object, or json_schema output formats), and an optional verbosity field that constrains the response length to "low", "medium", or "high".

Usage

Import this type when you need to inspect or type-check the text configuration returned in API responses. For constructing text config parameters to send to the API, use ResponseTextConfigParam instead.

Code Reference

Source Location

Signature

class ResponseTextConfig(BaseModel):
    """Configuration options for a text response from the model."""

    format: Optional[ResponseFormatTextConfig] = None
    verbosity: Optional[Literal["low", "medium", "high"]] = None

Import

from openai.types.responses import ResponseTextConfig

I/O Contract

Fields

Name Type Required Description
format Optional[ResponseFormatTextConfig] No An object specifying the output format. Can be text, json_object, or json_schema. Defaults to {"type": "text"}.
verbosity Optional[Literal["low", "medium", "high"]] No Constrains the verbosity of the model's response. Lower values produce more concise responses.

Usage Examples

import openai

client = openai.OpenAI()

response = client.responses.create(
    model="gpt-4o",
    input="Summarize the theory of relativity.",
    text={"format": {"type": "text"}, "verbosity": "low"},
)

# Access the text config from the response
print(response.text)

Related Pages

Page Connections

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