Implementation:Openai Openai python Fine Tuning Job Cancelled Webhook
| Knowledge Sources | |
|---|---|
| Domains | API_Types, Python |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
Concrete type for representing a fine-tuning job cancelled webhook event provided by the openai-python SDK.
Description
FineTuningJobCancelledWebhookEvent is a Pydantic model class that represents the webhook payload sent when a fine-tuning job has been cancelled. It extends BaseModel and includes an event identifier, a Unix timestamp for when the cancellation occurred, a nested Data payload containing the fine-tuning job ID, a literal type field fixed to "fine_tuning.job.cancelled", and an optional object field fixed to "event".
Usage
Import this type when building a webhook handler that needs to process fine-tuning job cancellation events from the OpenAI API. Use it to deserialize incoming webhook payloads and update job tracking records or notify users of the cancellation.
Code Reference
Source Location
- Repository: openai-python
- File: src/openai/types/webhooks/fine_tuning_job_cancelled_webhook_event.py
Signature
class Data(BaseModel):
"""Event data payload."""
id: str
class FineTuningJobCancelledWebhookEvent(BaseModel):
"""Sent when a fine-tuning job has been cancelled."""
id: str
created_at: int
data: Data
type: Literal["fine_tuning.job.cancelled"]
object: Optional[Literal["event"]] = None
Import
from openai.types.webhooks import FineTuningJobCancelledWebhookEvent
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 fine-tuning job was cancelled. |
| data | Data | Yes | Event data payload containing the fine-tuning job ID. |
| data.id | str | Yes | The unique ID of the fine-tuning job. |
| type | Literal["fine_tuning.job.cancelled"] | Yes | The type of the event. Always "fine_tuning.job.cancelled". |
| object | Optional[Literal["event"]] | No | The object of the event. Always "event" when present. |
Usage Examples
from openai.types.webhooks import FineTuningJobCancelledWebhookEvent
# Parse a webhook payload
event = FineTuningJobCancelledWebhookEvent.model_validate(payload)
print(f"Fine-tuning job {event.data.id} was cancelled at {event.created_at}")
print(f"Event type: {event.type}") # "fine_tuning.job.cancelled"