Fine-tuning
Get a fine tuning job
Retrieves a fine tuning job by its identifier.
Path parameters
fine_tuning_job_id
string
required
The ID of the fine-tuning job.
Responses
The request has succeeded.
Body
id
string
required
The object identifier, which can be referenced in the API endpoints.
created_at
integer
required
The Unix timestamp (in seconds) for when the fine-tuning job was created.
hyperparameters
OpenAI.FineTuningJobHyperparameters | null
The hyperparameters used for the fine-tuning job. This value will only be returned when running supervised jobs.
batch_size
enum | OpenAI.integer | null
enum
learning_rate_multiplier
enum | OpenAI.numeric
enum
n_epochs
enum | OpenAI.integer
enum
model
string
required
The base model that is being fine-tuned.
object
enum
required
The object type, which is always "fine_tuning.job".
organization_id
string
required
The organization that owns the fine-tuning job.
result_files
string[]
required
The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the Files API.
status
enum
required
The current status of the fine-tuning job, which can be validating_files, queued, running, pausing, paused, succeeded, failed, or cancelled.
training_file
string
required
The file ID used for training. You can retrieve the training data with the Files API.
seed
integer | null
required
The seed used for the fine-tuning job.
method
OpenAI.FineTuneMethod | null
The method used for fine-tuning.
type
enum
required
The type of method. Is either supervised, dpo, or reinforcement.
supervised
OpenAI.FineTuneSupervisedMethod
Configuration for the supervised fine-tuning method.
hyperparameters
OpenAI.FineTuneSupervisedHyperparameters
The hyperparameters used for the fine-tuning job.
batch_size
enum | OpenAI.integer
Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
enum
learning_rate_multiplier
enum | OpenAI.numeric
Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
enum
n_epochs
enum | OpenAI.integer
The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
enum
dpo
OpenAI.FineTuneDPOMethod
Configuration for the DPO fine-tuning method.
hyperparameters
OpenAI.FineTuneDPOHyperparameters
The hyperparameters used for the DPO fine-tuning job.
beta
enum | OpenAI.numeric
The beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.
enum
batch_size
enum | OpenAI.integer
Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
enum
learning_rate_multiplier
enum | OpenAI.numeric
Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
enum
n_epochs
enum | OpenAI.integer
The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
enum
reinforcement
OpenAI.FineTuneReinforcementMethod
Configuration for the reinforcement fine-tuning method.
grader
OpenAI.GraderStringCheck | OpenAI.GraderTextSimilarity | OpenAI.GraderPython | OpenAI.GraderScoreModel | OpenAI.GraderMulti
required
The grader used for the fine-tuning job.
type
enum
required
The object type, which is always string_check.
name
string
required
The name of the grader.
input
string
required
The input text. This may include template strings.
reference
string
required
The reference text. This may include template strings.
operation
enum
required
The string check operation to perform. One of eq, ne, like, or ilike.
type
enum
required
The type of grader.
name
string
required
The name of the grader.
input
string
required
The text being graded.
reference
string
required
The text being graded against.
evaluation_metric
enum
required
The evaluation metric to use. One of cosine, fuzzy_match, bleu, gleu, meteor, rouge_1, rouge_2, rouge_3, rouge_4, rouge_5, or rouge_l.
type
enum
required
The object type, which is always python.
name
string
required
The name of the grader.
source
string
required
The source code of the python script.
image_tag
string
The image tag to use for the python script.
type
enum
required
The object type, which is always score_model.
name
string
required
The name of the grader.
model
string
required
The model to use for the evaluation.
sampling_params
OpenAI.EvalGraderScoreModelSamplingParams
reasoning_effort
string | enum | null
Constrains effort on reasoning for reasoning models. Currently supported values are none, minimal, low, medium, high, xhigh, and max. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response. Not all reasoning models support every value. See the reasoning guide for model-specific support.
enum
input
OpenAI.EvalItem[]
required
The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.
range
OpenAI.numeric[]
The service requires two numbers for the score range. Defaults to [0, 1].
type
enum
required
The object type, which is always multi.
name
string
required
The name of the grader.
graders
object
required
[key: string]
OpenAI.GraderStringCheck | OpenAI.GraderTextSimilarity | OpenAI.GraderPython | OpenAI.GraderScoreModel | OpenAI.GraderLabelModel
type
enum
required
The object type, which is always string_check.
name
string
required
The name of the grader.
input
string
required
The input text. This may include template strings.
reference
string
required
The reference text. This may include template strings.
operation
enum
required
The string check operation to perform. One of eq, ne, like, or ilike.
type
enum
required
The type of grader.
name
string
required
The name of the grader.
input
string
required
The text being graded.
reference
string
required
The text being graded against.
evaluation_metric
enum
required
The evaluation metric to use. One of cosine, fuzzy_match, bleu, gleu, meteor, rouge_1, rouge_2, rouge_3, rouge_4, rouge_5, or rouge_l.
type
enum
required
The object type, which is always python.
name
string
required
The name of the grader.
source
string
required
The source code of the python script.
image_tag
string
The image tag to use for the python script.
type
enum
required
The object type, which is always score_model.
name
string
required
The name of the grader.
model
string
required
The model to use for the evaluation.
sampling_params
OpenAI.EvalGraderScoreModelSamplingParams
reasoning_effort
string | enum | null
Constrains effort on reasoning for reasoning models. Currently supported values are none, minimal, low, medium, high, xhigh, and max. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response. Not all reasoning models support every value. See the reasoning guide for model-specific support.
enum
input
OpenAI.EvalItem[]
required
The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.
range
OpenAI.numeric[]
The service requires two numbers for the score range. Defaults to [0, 1].
type
enum
required
The object type, which is always label_model.
name
string
required
The name of the grader.
model
string
required
The model to use for the evaluation. Must support structured outputs.
labels
string[]
required
The labels to assign to each item in the evaluation.
passing_labels
string[]
required
The labels that indicate a passing result. Must be a subset of labels.
calculate_output
string
required
A formula to calculate the output based on grader results.
hyperparameters
OpenAI.FineTuneReinforcementHyperparameters
The hyperparameters used for the reinforcement fine-tuning job.
batch_size
enum | OpenAI.integer
Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
enum
learning_rate_multiplier
enum | OpenAI.numeric
Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
enum
n_epochs
enum | OpenAI.integer
The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
enum
reasoning_effort
enum
Level of reasoning effort.
compute_multiplier
enum | OpenAI.numeric
Multiplier on amount of compute used for exploring search space during training.
enum
eval_interval
enum | OpenAI.integer
The number of training steps between evaluation runs.
enum
eval_samples
enum | OpenAI.integer
Number of evaluation samples to generate per training step.
enum
metadata
OpenAI.Metadata | null
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
Request
curl https://api.openai.com/v1/fine_tuning/jobs/ft-AF1WoRqd3aJAHsqc9NY7iL8F \
-H "Authorization: Bearer $OPENAI_API_KEY"
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
fine_tuning_job = client.fine_tuning.jobs.retrieve(
"ft-AF1WoRqd3aJAHsqc9NY7iL8F",
)
print(fine_tuning_job.id)
import OpenAI from "openai";
const openai = new OpenAI();
async function main() {
const fineTune = await openai.fineTuning.jobs.retrieve("ftjob-abc123");
console.log(fineTune);
}
main();
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});
const fineTuningJob = await client.fineTuning.jobs.retrieve('ft-AF1WoRqd3aJAHsqc9NY7iL8F');
console.log(fineTuningJob.id);
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAPIKey("My API Key"),
)
fineTuningJob, err := client.FineTuning.Jobs.Get(context.TODO(), "ft-AF1WoRqd3aJAHsqc9NY7iL8F")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v
", fineTuningJob.ID)
}
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.finetuning.jobs.FineTuningJob;
import com.openai.models.finetuning.jobs.JobRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
FineTuningJob fineTuningJob = client.fineTuning().jobs().retrieve("ft-AF1WoRqd3aJAHsqc9NY7iL8F");
}
}
require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
fine_tuning_job = openai.fine_tuning.jobs.retrieve("ft-AF1WoRqd3aJAHsqc9NY7iL8F")
puts(fine_tuning_job)
Response
{
"object": "fine_tuning.job",
"id": "ftjob-abc123",
"model": "davinci-002",
"created_at": 1692661014,
"finished_at": 1692661190,
"fine_tuned_model": "ft:davinci-002:my-org:custom_suffix:7q8mpxmy",
"organization_id": "org-123",
"result_files": [
"file-abc123"
],
"status": "succeeded",
"validation_file": null,
"training_file": "file-abc123",
"hyperparameters": {
"n_epochs": 4,
"batch_size": 1,
"learning_rate_multiplier": 1.0
},
"trained_tokens": 5768,
"integrations": [],
"seed": 0,
"estimated_finish": 0,
"method": {
"type": "supervised",
"supervised": {
"hyperparameters": {
"n_epochs": 4,
"batch_size": 1,
"learning_rate_multiplier": 1.0
}
}
}
}