Learn R Programming

openaiRtools (version 0.2.2)

create_fine_tuning_job: Create a Fine-tuning Job (Convenience Function)

Description

Shortcut that creates an OpenAI client from the OPENAI_API_KEY environment variable and calls client$fine_tuning$jobs$create().

Usage

create_fine_tuning_job(training_file, model = "gpt-3.5-turbo", ...)

Value

A fine-tuning job object with $id and $status.

Arguments

training_file

Character. Required. File ID of the uploaded training JSONL file (e.g. from upload_file(..., purpose = "fine-tune")).

model

Character. Base model to fine-tune: "gpt-3.5-turbo", "gpt-4o-mini", "gpt-4o", etc. Default: "gpt-3.5-turbo".

...

Additional parameters passed to FineTuningJobsClient$create(), such as suffix, hyperparameters (list with n_epochs, batch_size), validation_file, seed.

Examples

Run this code
if (FALSE) {
Sys.setenv(OPENAI_API_KEY = "sk-xxxxxx")

job <- create_fine_tuning_job(
  training_file   = "file-abc123",
  model           = "gpt-3.5-turbo",
  suffix          = "my-assistant",
  hyperparameters = list(n_epochs = 3)
)
cat("Job ID:", job$id)
}

Run the code above in your browser using DataLab