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 Shared Reasoning

From Leeroopedia
Revision as of 13:41, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Openai_Openai_python_Shared_Reasoning.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains API_Types, Python
Last Updated 2026-02-15 00:00 GMT

Overview

Concrete tool for configuring reasoning behavior for gpt-5 and o-series models provided by the openai-python SDK.

Description

Reasoning is a Pydantic BaseModel that provides configuration options for reasoning models. It contains three optional fields:

  • effort - A ReasoningEffort value constraining reasoning effort. Supported values are "none", "minimal", "low", "medium", "high", and "xhigh". Different models have different defaults: gpt-5.1 defaults to "none", models before gpt-5.1 default to "medium", and gpt-5-pro defaults to (and only supports) "high". The "xhigh" level is available for models after gpt-5.1-codex-max.
  • generate_summary - Deprecated in favor of summary. Controls whether the model provides a summary of its reasoning process.
  • summary - Controls reasoning summary output with values "auto", "concise", or "detailed". Useful for debugging and understanding the model's reasoning process.

Usage

Import Reasoning when configuring reasoning parameters for chat completions or responses API calls with reasoning-capable models.

Code Reference

Source Location

Signature

class Reasoning(BaseModel):
    effort: Optional[ReasoningEffort] = None
    generate_summary: Optional[Literal["auto", "concise", "detailed"]] = None
    summary: Optional[Literal["auto", "concise", "detailed"]] = None

Import

from openai.types.shared import Reasoning

I/O Contract

Fields

Name Type Required Description
effort Optional[ReasoningEffort] No Constrains reasoning effort. Values: "none", "minimal", "low", "medium", "high", "xhigh". Reducing effort results in faster responses and fewer reasoning tokens.
generate_summary Optional[Literal["auto", "concise", "detailed"]] No (Deprecated) Use summary instead. Summary of reasoning performed by the model.
summary Optional[Literal["auto", "concise", "detailed"]] No Summary of reasoning performed by the model. Useful for debugging. "concise" supported for computer-use-preview and reasoning models after gpt-5.

Usage Examples

from openai import OpenAI
from openai.types.shared import Reasoning

client = OpenAI()

# Configure reasoning with high effort and concise summary
response = client.chat.completions.create(
    model="o3",
    messages=[{"role": "user", "content": "Solve this math problem: ..."}],
    reasoning=Reasoning(
        effort="high",
        summary="concise",
    ).model_dump(),
)

# Use low effort for faster responses
response = client.chat.completions.create(
    model="gpt-5.1",
    messages=[{"role": "user", "content": "Simple question"}],
    reasoning=Reasoning(effort="low").model_dump(),
)

Related Pages

Page Connections

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