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.FineTuningJob — Type
FineTuningJobA fine-tuning job: id, status, model, and fine_tuned_model (the resulting model name once training completes); raw holds the unparsed JSON response.
UniLM.FineTuningList — Type
FineTuningListA page of records from list_fine_tuning_jobs, list_fine_tuning_events, or list_fine_tuning_checkpoints; data holds the raw JSON entries and has_more signals that further pages are available.
Result Types
UniLM.FineTuningSuccess — Type
Successful create/retrieve/cancel result wrapping a FineTuningJob.
UniLM.FineTuningListSuccess — Type
Successful list result wrapping a FineTuningList.
UniLM.FineTuningFailure — Type
Fine-tuning API error result: HTTP status and the raw response body.
UniLM.FineTuningCallError — Type
Local/transport error from a Fine-tuning API call (the request never completed).
Request Functions
UniLM.create_fine_tuning_job — Function
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).
UniLM.retrieve_fine_tuning_job — Function
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).
UniLM.cancel_fine_tuning_job — Function
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).
UniLM.list_fine_tuning_jobs — Function
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).
UniLM.list_fine_tuning_events — Function
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).
UniLM.list_fine_tuning_checkpoints — Function
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).
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")