Python (SDK)
from meetkai_mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.llm.fine_tuning.create(model="meetkai:functionary-medium", training_file="file_abc123", suffix="my-model", method={
"type": "supervised",
"supervised": {
"hyperparameters": {
"n_epochs": 3,
},
},
})
# Handle response
print(res)import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.fineTuning.create({
model: "meetkai:functionary-medium",
trainingFile: "file_abc123",
suffix: "my-model",
method: {
type: "supervised",
supervised: {
hyperparameters: {
nEpochs: 3,
},
},
},
});
console.log(result);
}
run();using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
var sdk = new SDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
CreateFineTuningJobRequest req = new CreateFineTuningJobRequest() {
Model = "meetkai:functionary-medium",
TrainingFile = "file_abc123",
Suffix = "my-model",
Method = new Method() {
Type = MethodType.Supervised,
Supervised = new Supervised() {
Hyperparameters = new SupervisedHyperparameters() {
NEpochs = SupervisedHyperparametersNEpochs.CreateInteger(
3
),
},
},
},
};
var res = await sdk.Llm.FineTuning.CreateAsync(req);
// handle responsecurl --request POST \
--url https://apigw.mka1.com/api/v1/llm/fine_tuning/jobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "meetkai:functionary-medium",
"training_file": "file_abc123",
"suffix": "my-model",
"method": {
"type": "supervised",
"supervised": {
"hyperparameters": {
"n_epochs": 3
}
}
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'meetkai:functionary-medium',
training_file: 'file_abc123',
suffix: 'my-model',
method: {type: 'supervised', supervised: {hyperparameters: {n_epochs: 3}}}
})
};
fetch('https://apigw.mka1.com/api/v1/llm/fine_tuning/jobs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apigw.mka1.com/api/v1/llm/fine_tuning/jobs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'meetkai:functionary-medium',
'training_file' => 'file_abc123',
'suffix' => 'my-model',
'method' => [
'type' => 'supervised',
'supervised' => [
'hyperparameters' => [
'n_epochs' => 3
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apigw.mka1.com/api/v1/llm/fine_tuning/jobs"
payload := strings.NewReader("{\n \"model\": \"meetkai:functionary-medium\",\n \"training_file\": \"file_abc123\",\n \"suffix\": \"my-model\",\n \"method\": {\n \"type\": \"supervised\",\n \"supervised\": {\n \"hyperparameters\": {\n \"n_epochs\": 3\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apigw.mka1.com/api/v1/llm/fine_tuning/jobs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"meetkai:functionary-medium\",\n \"training_file\": \"file_abc123\",\n \"suffix\": \"my-model\",\n \"method\": {\n \"type\": \"supervised\",\n \"supervised\": {\n \"hyperparameters\": {\n \"n_epochs\": 3\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/llm/fine_tuning/jobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"meetkai:functionary-medium\",\n \"training_file\": \"file_abc123\",\n \"suffix\": \"my-model\",\n \"method\": {\n \"type\": \"supervised\",\n \"supervised\": {\n \"hyperparameters\": {\n \"n_epochs\": 3\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "ftjob_aa87e2b1112a455b8deabed784372198",
"object": "fine_tuning.job",
"created_at": 1704067200,
"model": "meetkai:functionary-medium",
"training_file": "file_abc123",
"validation_file": null,
"fine_tuned_model": null,
"organization_id": "org-123",
"status": "running",
"result_files": [],
"seed": 42,
"hyperparameters": {
"n_epochs": 3,
"batch_size": "auto",
"learning_rate_multiplier": "auto"
},
"method": {
"type": "supervised",
"supervised": {
"hyperparameters": {
"n_epochs": 3
}
}
},
"finished_at": null,
"estimated_finish": null,
"trained_tokens": null,
"error": null,
"integrations": null,
"metadata": {
"experiment": "v1"
},
"suffix": "my-model"
}Fine-Tuning
Create a fine-tuning job
Creates a fine-tuning job which begins the process of training a new model from a given dataset.
POST
/
api
/
v1
/
llm
/
fine_tuning
/
jobs
Python (SDK)
from meetkai_mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.llm.fine_tuning.create(model="meetkai:functionary-medium", training_file="file_abc123", suffix="my-model", method={
"type": "supervised",
"supervised": {
"hyperparameters": {
"n_epochs": 3,
},
},
})
# Handle response
print(res)import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.fineTuning.create({
model: "meetkai:functionary-medium",
trainingFile: "file_abc123",
suffix: "my-model",
method: {
type: "supervised",
supervised: {
hyperparameters: {
nEpochs: 3,
},
},
},
});
console.log(result);
}
run();using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
var sdk = new SDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
CreateFineTuningJobRequest req = new CreateFineTuningJobRequest() {
Model = "meetkai:functionary-medium",
TrainingFile = "file_abc123",
Suffix = "my-model",
Method = new Method() {
Type = MethodType.Supervised,
Supervised = new Supervised() {
Hyperparameters = new SupervisedHyperparameters() {
NEpochs = SupervisedHyperparametersNEpochs.CreateInteger(
3
),
},
},
},
};
var res = await sdk.Llm.FineTuning.CreateAsync(req);
// handle responsecurl --request POST \
--url https://apigw.mka1.com/api/v1/llm/fine_tuning/jobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "meetkai:functionary-medium",
"training_file": "file_abc123",
"suffix": "my-model",
"method": {
"type": "supervised",
"supervised": {
"hyperparameters": {
"n_epochs": 3
}
}
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'meetkai:functionary-medium',
training_file: 'file_abc123',
suffix: 'my-model',
method: {type: 'supervised', supervised: {hyperparameters: {n_epochs: 3}}}
})
};
fetch('https://apigw.mka1.com/api/v1/llm/fine_tuning/jobs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apigw.mka1.com/api/v1/llm/fine_tuning/jobs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'meetkai:functionary-medium',
'training_file' => 'file_abc123',
'suffix' => 'my-model',
'method' => [
'type' => 'supervised',
'supervised' => [
'hyperparameters' => [
'n_epochs' => 3
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apigw.mka1.com/api/v1/llm/fine_tuning/jobs"
payload := strings.NewReader("{\n \"model\": \"meetkai:functionary-medium\",\n \"training_file\": \"file_abc123\",\n \"suffix\": \"my-model\",\n \"method\": {\n \"type\": \"supervised\",\n \"supervised\": {\n \"hyperparameters\": {\n \"n_epochs\": 3\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apigw.mka1.com/api/v1/llm/fine_tuning/jobs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"meetkai:functionary-medium\",\n \"training_file\": \"file_abc123\",\n \"suffix\": \"my-model\",\n \"method\": {\n \"type\": \"supervised\",\n \"supervised\": {\n \"hyperparameters\": {\n \"n_epochs\": 3\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/llm/fine_tuning/jobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"meetkai:functionary-medium\",\n \"training_file\": \"file_abc123\",\n \"suffix\": \"my-model\",\n \"method\": {\n \"type\": \"supervised\",\n \"supervised\": {\n \"hyperparameters\": {\n \"n_epochs\": 3\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "ftjob_aa87e2b1112a455b8deabed784372198",
"object": "fine_tuning.job",
"created_at": 1704067200,
"model": "meetkai:functionary-medium",
"training_file": "file_abc123",
"validation_file": null,
"fine_tuned_model": null,
"organization_id": "org-123",
"status": "running",
"result_files": [],
"seed": 42,
"hyperparameters": {
"n_epochs": 3,
"batch_size": "auto",
"learning_rate_multiplier": "auto"
},
"method": {
"type": "supervised",
"supervised": {
"hyperparameters": {
"n_epochs": 3
}
}
},
"finished_at": null,
"estimated_finish": null,
"trained_tokens": null,
"error": null,
"integrations": null,
"metadata": {
"experiment": "v1"
},
"suffix": "my-model"
}Authorizations
Gateway auth: send Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, you can also send X-On-Behalf-Of: <external-user-id>.
Body
application/json
The base model to fine-tune
File ID of the training data JSONL file
File ID of the validation data JSONL file
Suffix appended to the fine-tuned model name
Maximum string length:
64Seed for reproducibility
Required range:
-9007199254740991 <= x <= 9007199254740991Deprecated: use method instead
Show child attributes
Show child attributes
Fine-tuning method configuration
Show child attributes
Show child attributes
External integrations
Show child attributes
Show child attributes
Up to 16 key-value pairs
Show child attributes
Show child attributes
Response
200 - application/json
OK
Required range:
-9007199254740991 <= x <= 9007199254740991Available options:
validating_files, queued, running, succeeded, failed, cancelled Required range:
-9007199254740991 <= x <= 9007199254740991Show child attributes
Show child attributes
Show child attributes
Show child attributes
Required range:
-9007199254740991 <= x <= 9007199254740991Required range:
-9007199254740991 <= x <= 9007199254740991Required range:
-9007199254740991 <= x <= 9007199254740991Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?
⌘I