Fine-tuning API

OpenAI restricts new jobs to eligible existing customers. Job creation ends January 6, 2027; inference remains available until the base model retires. See OpenAI's availability schedule.

Create, retrieve, cancel, and list fine-tuning jobs, and list a job's events and checkpoints. Training and validation data is uploaded via the Files API with purpose="fine-tune". OpenAI only.

Objects

UniLM.FineTuningJobType
FineTuningJob

A fine-tuning job: id, status, model, and fine_tuned_model (the resulting model name once training completes); raw holds the unparsed JSON response.

source

Result Types

Request Functions

UniLM.create_fine_tuning_jobFunction
create_fine_tuning_job(; model, training_file, validation_file=nothing, method=nothing,
                       suffix=nothing, metadata=nothing, service=OPENAIServiceEndpoint)

Create a fine-tuning job. training_file is a file id from upload_file(path, "fine-tune"). method is e.g. Dict("type"=>"supervised", "supervised"=>Dict("hyperparameters"=>...)).

Pass config::Union{Nothing,RequestConfig} to override the timeout budget for this call (a single bounded attempt; max_attempts does not apply).

source
UniLM.retrieve_fine_tuning_jobFunction
retrieve_fine_tuning_job(id; service=OPENAIServiceEndpoint)

Pass config::Union{Nothing,RequestConfig} to override the timeout budget for this call (a single bounded attempt; max_attempts does not apply).

source
UniLM.cancel_fine_tuning_jobFunction
cancel_fine_tuning_job(id; service=OPENAIServiceEndpoint)

Pass config::Union{Nothing,RequestConfig} to override the timeout budget for this call (a single bounded attempt; max_attempts does not apply).

source
UniLM.list_fine_tuning_jobsFunction
list_fine_tuning_jobs(; limit=nothing, after=nothing, service=OPENAIServiceEndpoint)

Pass config::Union{Nothing,RequestConfig} to override the timeout budget for this call (a single bounded attempt; max_attempts does not apply).

source
UniLM.list_fine_tuning_eventsFunction
list_fine_tuning_events(id; service=OPENAIServiceEndpoint)

Pass config::Union{Nothing,RequestConfig} to override the timeout budget for this call (a single bounded attempt; max_attempts does not apply).

source
UniLM.list_fine_tuning_checkpointsFunction
list_fine_tuning_checkpoints(id; service=OPENAIServiceEndpoint)

Pass config::Union{Nothing,RequestConfig} to override the timeout budget for this call (a single bounded attempt; max_attempts does not apply).

source

Usage

# Upload training data (purpose="fine-tune"), then create a job
train = upload_file("train.jsonl", "fine-tune")
job = create_fine_tuning_job(model="gpt-4o-mini", training_file="file-abc123")
job isa FineTuningSuccess && println("Job: ", job.response.id)

# Retrieve status, list events / checkpoints, list all jobs, cancel
retrieve_fine_tuning_job("ftjob-abc123")
list_fine_tuning_events("ftjob-abc123")
list_fine_tuning_checkpoints("ftjob-abc123")
list_fine_tuning_jobs(limit=10)
cancel_fine_tuning_job("ftjob-abc123")