TsgcHTTP_API_OpenAIMethods › CreateFineTuningJob

CreateFineTuningJob Method

Starts a new fine-tuning job that customizes a base model on a previously uploaded training file

Syntax

function CreateFineTuningJob(const aRequest : TsgcOpenAIClass_Request_FineTuningJob) : TsgcOpenAIClass_Response_FineTuningJob;

Parameters

NameTypeDescription
aRequestconst TsgcOpenAIClass_Request_FineTuningJobFine-tuning request with base model, training file id, hyperparameters and optional validation file

Return Value

Fine-tuning job descriptor with id, status and creation timestamp (TsgcOpenAIClass_Response_FineTuningJob)

Remarks

Calls the POST /v1/fine_tuning/jobs endpoint. This is the current fine-tuning API and supersedes the legacy /v1/fine-tunes endpoints (CreateFineTune and friends), which are deprecated. The training file must be uploaded first with purpose "fine-tune" and the request must reference its id. Monitor the job via RetrieveFineTuningJob or ListFineTuningJobEvents until it succeeds.

Example

oRequest := TsgcOpenAIClass_Request_FineTuningJob.Create;
oRequest.Model := 'gpt-4o-mini-2024-07-18';
oRequest.TrainingFile := 'file-abc123';
oRequest.Suffix := 'custom-support';
oResponse := oAPI.CreateFineTuningJob(oRequest);
ShowMessage('Job id: ' + oResponse.Id);

Back to Methods