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"
}Crie um trabalho de ajuste fino
Cria um trabalho de ajuste fino que inicia o processo de treinamento de um novo modelo a partir de um conjunto de dados fornecido.
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"
}Autorizações
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>.
Corpo
O modelo base para ajuste fino
ID do arquivo do arquivo JSONL de dados de treinamento
ID do arquivo do dados de validação JSONL
Sufixo adicionado ao nome do modelo ajustado finamente
64Semente para reprodutibilidade
-9007199254740991 <= x <= 9007199254740991Depreciado: use o método em vez disso
Show child attributes
Show child attributes
Configuração do método de ajuste fino
Show child attributes
Show child attributes
Integrações externas
Show child attributes
Show child attributes
Até 16 pares de chave-valor
Show child attributes
Show child attributes
Resposta
OK
-9007199254740991 <= x <= 9007199254740991validating_files, queued, running, succeeded, failed, cancelled -9007199254740991 <= x <= 9007199254740991Show child attributes
Show child attributes
Show child attributes
Show child attributes
-9007199254740991 <= x <= 9007199254740991-9007199254740991 <= x <= 9007199254740991-9007199254740991 <= x <= 9007199254740991Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Esta página foi útil?