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 Incomplete Event

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

Overview

Concrete streaming event type for signaling that a response finished as incomplete provided by the openai-python SDK.

Description

ResponseIncompleteEvent is a Pydantic model emitted when a response finishes as incomplete. It carries a response field containing the full Response object that was incomplete, a sequence_number for event ordering, and a type field always set to "response.incomplete". This event indicates that the model stopped generating before the response was fully complete, which may occur due to token limits, content filtering, or other constraints.

Usage

Import this type when building streaming event handlers that need to detect incomplete responses and take corrective action, such as retrying the request or notifying the user.

Code Reference

Source Location

Signature

class ResponseIncompleteEvent(BaseModel):
    """An event that is emitted when a response finishes as incomplete."""

    response: Response
    sequence_number: int
    type: Literal["response.incomplete"]

Import

from openai.types.responses import ResponseIncompleteEvent

I/O Contract

Fields

Name Type Required Description
response Response Yes The response that was incomplete.
sequence_number int Yes The sequence number of this event.
type Literal["response.incomplete"] Yes The type of the event. Always response.incomplete.

Usage Examples

import openai

client = openai.OpenAI()

stream = client.responses.create(
    model="gpt-4o",
    input="Write a very long essay about the history of computing.",
    stream=True,
)

for event in stream:
    if event.type == "response.incomplete":
        print("Response was incomplete!")
        print(f"Response ID: {event.response.id}")
        print(f"Status: {event.response.status}")

Related Pages

Page Connections

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