Implementation:Openai Openai python Fine Tuning Jobs Retrieve
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Fine_Tuning, Monitoring |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
Concrete tool for monitoring fine-tuning jobs through retrieval, listing, and event log access provided by the OpenAI Python SDK.
Description
The Jobs resource provides retrieve() for single job status, list() for paginated job listing, and list_events() for training progress events. The FineTuningJob model tracks status, trained tokens, hyperparameters, and the output model name.
Usage
Call client.fine_tuning.jobs.retrieve(job_id) for status checks. Use list_events() to see training metrics.
Code Reference
Source Location
- Repository: openai-python
- File: src/openai/resources/fine_tuning/jobs/jobs.py
Signature
class Jobs(SyncAPIResource):
def retrieve(
self,
fine_tuning_job_id: str,
) -> FineTuningJob:
"""Retrieves a fine-tuning job by ID."""
def list(
self,
*,
after: str | NotGiven = NOT_GIVEN,
limit: int | NotGiven = NOT_GIVEN,
) -> SyncCursorPage[FineTuningJob]:
"""Lists fine-tuning jobs with pagination."""
def list_events(
self,
fine_tuning_job_id: str,
*,
after: str | NotGiven = NOT_GIVEN,
limit: int | NotGiven = NOT_GIVEN,
) -> SyncCursorPage[FineTuningJobEvent]:
"""Lists events for a fine-tuning job."""
Import
from openai import OpenAI
# client.fine_tuning.jobs.retrieve(), .list(), .list_events()
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| fine_tuning_job_id | str | Yes | Job ID to monitor |
| after | str | No | Pagination cursor |
| limit | int | No | Maximum results per page |
Outputs
| Name | Type | Description |
|---|---|---|
| job.status | str | validating_files, queued, running, succeeded, failed, cancelled |
| job.fine_tuned_model | str or None | Output model name (set when succeeded) |
| job.trained_tokens | int or None | Number of tokens trained |
| events | SyncCursorPage[FineTuningJobEvent] | Training events with messages |
Usage Examples
Monitor Job Status
import time
from openai import OpenAI
client = OpenAI()
job_id = "ftjob-abc123"
while True:
job = client.fine_tuning.jobs.retrieve(job_id)
print(f"Status: {job.status}")
if job.status == "succeeded":
print(f"Fine-tuned model: {job.fine_tuned_model}")
break
elif job.status == "failed":
print(f"Job failed: {job.error}")
break
time.sleep(30)
List Events
events = client.fine_tuning.jobs.list_events(
fine_tuning_job_id="ftjob-abc123",
limit=10,
)
for event in events:
print(f"[{event.created_at}] {event.message}")
List All Jobs
jobs = client.fine_tuning.jobs.list(limit=10)
for job in jobs:
print(f"{job.id}: {job.status} -> {job.fine_tuned_model}")
Related Pages
Implements Principle
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment