Implementation:Openai Openai python Response Incomplete Webhook
| Knowledge Sources | |
|---|---|
| Domains | API_Types, Python |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
Concrete type for representing a response incomplete webhook event provided by the openai-python SDK.
Description
ResponseIncompleteWebhookEvent is a Pydantic model class that represents the webhook payload sent when a background response has been interrupted. It extends BaseModel and includes an event identifier, a Unix timestamp for when the interruption occurred, a nested Data payload containing the model response ID, a literal type field fixed to "response.incomplete", and an optional object field fixed to "event".
Usage
Import this type when building a webhook handler that needs to process background response interruption events from the OpenAI API. Use it to deserialize incoming webhook payloads and decide whether to retry the request or handle partial results.
Code Reference
Source Location
- Repository: openai-python
- File: src/openai/types/webhooks/response_incomplete_webhook_event.py
Signature
class Data(BaseModel):
"""Event data payload."""
id: str
class ResponseIncompleteWebhookEvent(BaseModel):
"""Sent when a background response has been interrupted."""
id: str
created_at: int
data: Data
type: Literal["response.incomplete"]
object: Optional[Literal["event"]] = None
Import
from openai.types.webhooks import ResponseIncompleteWebhookEvent
I/O Contract
Fields
| Name | Type | Required | Description |
|---|---|---|---|
| id | str | Yes | The unique ID of the event. |
| created_at | int | Yes | Unix timestamp (in seconds) of when the model response was interrupted. |
| data | Data | Yes | Event data payload containing the model response ID. |
| data.id | str | Yes | The unique ID of the model response. |
| type | Literal["response.incomplete"] | Yes | The type of the event. Always "response.incomplete". |
| object | Optional[Literal["event"]] | No | The object of the event. Always "event" when present. |
Usage Examples
from openai.types.webhooks import ResponseIncompleteWebhookEvent
# Parse a webhook payload
event = ResponseIncompleteWebhookEvent.model_validate(payload)
print(f"Response {event.data.id} was interrupted at {event.created_at}")
print(f"Event type: {event.type}") # "response.incomplete"