Create a fine tuning job
Creates a new fine-tuning job that trains a model on the provided dataset, and returns the created job.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const fineTuningJob = await client.ai.fineTuning.jobs.create({
model: 'model',
training_file: 'training_file',
});
console.log(fineTuningJob.id);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
fine_tuning_job = client.ai.fine_tuning.jobs.create(
model="model",
training_file="training_file",
)
print(fine_tuning_job.id)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
fineTuningJob, err := client.AI.FineTuning.Jobs.New(context.TODO(), telnyx.AIFineTuningJobNewParams{
Model: "model",
TrainingFile: "training_file",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", fineTuningJob.ID)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.ai.finetuning.jobs.FineTuningJob;
import com.telnyx.sdk.models.ai.finetuning.jobs.JobCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
JobCreateParams params = JobCreateParams.builder()
.model("model")
.trainingFile("training_file")
.build();
FineTuningJob fineTuningJob = client.ai().fineTuning().jobs().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
fine_tuning_job = telnyx.ai.fine_tuning.jobs.create(model: "model", training_file: "training_file")
puts(fine_tuning_job)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$fineTuningJob = $client->ai->fineTuning->jobs->create(
model: 'model',
trainingFile: 'training_file',
hyperparameters: ['nEpochs' => 1],
suffix: 'suffix',
);
var_dump($fineTuningJob);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai:fine-tuning:jobs create \
--api-key 'My API Key' \
--model model \
--training-file training_filecurl --request POST \
--url https://api.telnyx.com/v2/ai/fine_tuning/jobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "string",
"training_file": "string",
"suffix": "string",
"hyperparameters": {
"n_epochs": 3
}
}
'{
"id": "string",
"created_at": 0,
"hyperparameters": {
"n_epochs": 3
},
"model": "string",
"organization_id": "string",
"status": "queued",
"training_file": "string",
"finished_at": null,
"trained_tokens": null
}{
"detail": [
{
"loc": [
"body",
"name"
],
"msg": "Field required",
"type": "missing"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Response
Successful Response
The fine_tuning.job object represents a fine-tuning job that has been created through the API.
The name of the fine-tuned model that is being created.
The Unix timestamp (in seconds) for when the fine-tuning job was created.
The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running.
The hyperparameters used for the fine-tuning job.
Show child attributes
Show child attributes
The base model that is being fine-tuned.
The organization that owns the fine-tuning job.
The current status of the fine-tuning job.
queued, running, succeeded, failed, cancelled The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running.
The storage bucket or object used for training.
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const fineTuningJob = await client.ai.fineTuning.jobs.create({
model: 'model',
training_file: 'training_file',
});
console.log(fineTuningJob.id);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
fine_tuning_job = client.ai.fine_tuning.jobs.create(
model="model",
training_file="training_file",
)
print(fine_tuning_job.id)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
fineTuningJob, err := client.AI.FineTuning.Jobs.New(context.TODO(), telnyx.AIFineTuningJobNewParams{
Model: "model",
TrainingFile: "training_file",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", fineTuningJob.ID)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.ai.finetuning.jobs.FineTuningJob;
import com.telnyx.sdk.models.ai.finetuning.jobs.JobCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
JobCreateParams params = JobCreateParams.builder()
.model("model")
.trainingFile("training_file")
.build();
FineTuningJob fineTuningJob = client.ai().fineTuning().jobs().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
fine_tuning_job = telnyx.ai.fine_tuning.jobs.create(model: "model", training_file: "training_file")
puts(fine_tuning_job)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$fineTuningJob = $client->ai->fineTuning->jobs->create(
model: 'model',
trainingFile: 'training_file',
hyperparameters: ['nEpochs' => 1],
suffix: 'suffix',
);
var_dump($fineTuningJob);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai:fine-tuning:jobs create \
--api-key 'My API Key' \
--model model \
--training-file training_filecurl --request POST \
--url https://api.telnyx.com/v2/ai/fine_tuning/jobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "string",
"training_file": "string",
"suffix": "string",
"hyperparameters": {
"n_epochs": 3
}
}
'{
"id": "string",
"created_at": 0,
"hyperparameters": {
"n_epochs": 3
},
"model": "string",
"organization_id": "string",
"status": "queued",
"training_file": "string",
"finished_at": null,
"trained_tokens": null
}{
"detail": [
{
"loc": [
"body",
"name"
],
"msg": "Field required",
"type": "missing"
}
]
}