from meetkai_mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.datasets.create_generation(idempotency_key="<value>", generator_id="<id>", params={
"key": "<value>",
"key1": "<value>",
}, output={
"repo": "<value>",
})
# 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.datasets.createGeneration({
idempotencyKey: "<value>",
createGeneration: {
generatorId: "<id>",
params: {
"key": "<value>",
"key1": "<value>",
},
output: {
repo: "<value>",
},
},
});
console.log(result);
}
run();using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
using System.Collections.Generic;
var sdk = new SDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.Datasets.CreateGenerationAsync(
idempotencyKey: "<value>",
body: new CreateGeneration() {
GeneratorId = "<id>",
Params = new Dictionary<string, object>() {
{ "key", "<value>" },
{ "key1", "<value>" },
},
Output = new OutputSpec() {
Repo = "<value>",
},
}
);
// handle responsecurl --request POST \
--url https://apigw.mka1.com/api/v1/datasets/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"generator_id": "<string>",
"params": {},
"output": {
"repo": "<string>",
"revision": "main"
},
"inputs": {},
"limits": {
"max_runtime_hours": 1,
"max_cost": 1,
"max_llm_calls": 1
},
"name": "<string>",
"derived_from": [
"<string>"
]
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
generator_id: '<string>',
params: {},
output: {repo: '<string>', revision: 'main'},
inputs: {},
limits: {max_runtime_hours: 1, max_cost: 1, max_llm_calls: 1},
name: '<string>',
derived_from: ['<string>']
})
};
fetch('https://apigw.mka1.com/api/v1/datasets/generations', 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/datasets/generations",
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([
'generator_id' => '<string>',
'params' => [
],
'output' => [
'repo' => '<string>',
'revision' => 'main'
],
'inputs' => [
],
'limits' => [
'max_runtime_hours' => 1,
'max_cost' => 1,
'max_llm_calls' => 1
],
'name' => '<string>',
'derived_from' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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/datasets/generations"
payload := strings.NewReader("{\n \"generator_id\": \"<string>\",\n \"params\": {},\n \"output\": {\n \"repo\": \"<string>\",\n \"revision\": \"main\"\n },\n \"inputs\": {},\n \"limits\": {\n \"max_runtime_hours\": 1,\n \"max_cost\": 1,\n \"max_llm_calls\": 1\n },\n \"name\": \"<string>\",\n \"derived_from\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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/datasets/generations")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"generator_id\": \"<string>\",\n \"params\": {},\n \"output\": {\n \"repo\": \"<string>\",\n \"revision\": \"main\"\n },\n \"inputs\": {},\n \"limits\": {\n \"max_runtime_hours\": 1,\n \"max_cost\": 1,\n \"max_llm_calls\": 1\n },\n \"name\": \"<string>\",\n \"derived_from\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/datasets/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"generator_id\": \"<string>\",\n \"params\": {},\n \"output\": {\n \"repo\": \"<string>\",\n \"revision\": \"main\"\n },\n \"inputs\": {},\n \"limits\": {\n \"max_runtime_hours\": 1,\n \"max_cost\": 1,\n \"max_llm_calls\": 1\n },\n \"name\": \"<string>\",\n \"derived_from\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"state": "<string>",
"reason": {},
"generator": {
"id": "<string>",
"version": "<string>"
},
"params": {},
"params_hash": "<string>",
"output": {
"repo": "<string>",
"revision": "<string>",
"commit": "<string>"
},
"inputs": {},
"counts": {},
"llm": {
"models": [
"<string>"
]
},
"limits": {
"max_runtime_hours": 123,
"max_cost": 1,
"max_llm_calls": 1
},
"usage": {},
"job": {
"name": "<string>",
"attempt": 123
},
"name": "<string>",
"derived_from": [
"<string>"
],
"created_by": {
"user_id": "<string>",
"team_id": "<string>",
"api_key_id": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"terminal_at": "2023-11-07T05:31:56Z",
"duplicate_of": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Criar Geração
A sequência do components.md §6 D.1, em sua ordem: nada é escrito antes que o digest seja fixado, e o fluxo de trabalho só começa após a linha ser confirmada.
from meetkai_mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.datasets.create_generation(idempotency_key="<value>", generator_id="<id>", params={
"key": "<value>",
"key1": "<value>",
}, output={
"repo": "<value>",
})
# 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.datasets.createGeneration({
idempotencyKey: "<value>",
createGeneration: {
generatorId: "<id>",
params: {
"key": "<value>",
"key1": "<value>",
},
output: {
repo: "<value>",
},
},
});
console.log(result);
}
run();using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
using System.Collections.Generic;
var sdk = new SDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.Datasets.CreateGenerationAsync(
idempotencyKey: "<value>",
body: new CreateGeneration() {
GeneratorId = "<id>",
Params = new Dictionary<string, object>() {
{ "key", "<value>" },
{ "key1", "<value>" },
},
Output = new OutputSpec() {
Repo = "<value>",
},
}
);
// handle responsecurl --request POST \
--url https://apigw.mka1.com/api/v1/datasets/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"generator_id": "<string>",
"params": {},
"output": {
"repo": "<string>",
"revision": "main"
},
"inputs": {},
"limits": {
"max_runtime_hours": 1,
"max_cost": 1,
"max_llm_calls": 1
},
"name": "<string>",
"derived_from": [
"<string>"
]
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
generator_id: '<string>',
params: {},
output: {repo: '<string>', revision: 'main'},
inputs: {},
limits: {max_runtime_hours: 1, max_cost: 1, max_llm_calls: 1},
name: '<string>',
derived_from: ['<string>']
})
};
fetch('https://apigw.mka1.com/api/v1/datasets/generations', 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/datasets/generations",
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([
'generator_id' => '<string>',
'params' => [
],
'output' => [
'repo' => '<string>',
'revision' => 'main'
],
'inputs' => [
],
'limits' => [
'max_runtime_hours' => 1,
'max_cost' => 1,
'max_llm_calls' => 1
],
'name' => '<string>',
'derived_from' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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/datasets/generations"
payload := strings.NewReader("{\n \"generator_id\": \"<string>\",\n \"params\": {},\n \"output\": {\n \"repo\": \"<string>\",\n \"revision\": \"main\"\n },\n \"inputs\": {},\n \"limits\": {\n \"max_runtime_hours\": 1,\n \"max_cost\": 1,\n \"max_llm_calls\": 1\n },\n \"name\": \"<string>\",\n \"derived_from\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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/datasets/generations")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"generator_id\": \"<string>\",\n \"params\": {},\n \"output\": {\n \"repo\": \"<string>\",\n \"revision\": \"main\"\n },\n \"inputs\": {},\n \"limits\": {\n \"max_runtime_hours\": 1,\n \"max_cost\": 1,\n \"max_llm_calls\": 1\n },\n \"name\": \"<string>\",\n \"derived_from\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/datasets/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"generator_id\": \"<string>\",\n \"params\": {},\n \"output\": {\n \"repo\": \"<string>\",\n \"revision\": \"main\"\n },\n \"inputs\": {},\n \"limits\": {\n \"max_runtime_hours\": 1,\n \"max_cost\": 1,\n \"max_llm_calls\": 1\n },\n \"name\": \"<string>\",\n \"derived_from\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"state": "<string>",
"reason": {},
"generator": {
"id": "<string>",
"version": "<string>"
},
"params": {},
"params_hash": "<string>",
"output": {
"repo": "<string>",
"revision": "<string>",
"commit": "<string>"
},
"inputs": {},
"counts": {},
"llm": {
"models": [
"<string>"
]
},
"limits": {
"max_runtime_hours": 123,
"max_cost": 1,
"max_llm_calls": 1
},
"usage": {},
"job": {
"name": "<string>",
"attempt": 123
},
"name": "<string>",
"derived_from": [
"<string>"
],
"created_by": {
"user_id": "<string>",
"team_id": "<string>",
"api_key_id": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"terminal_at": "2023-11-07T05:31:56Z",
"duplicate_of": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}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>.
Cabeçalhos
1 - 255Optional external end-user identifier forwarded by the API gateway.
Corpo
1 - 64Show child attributes
Show child attributes
Show child attributes
Show child attributes
Cada valor pode ser apenas menor do que o padrão do gerador (api.md §3).
Show child attributes
Show child attributes
200100Resposta
Resposta Bem-Sucedida
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
O orçamento de uma execução: os default_limits do gerador, ou os efetivos como ctx.limits.
Sem padrões. Cada número aqui é um limite que a plataforma impõe e contra o qual um chamador pode ser cobrado, então um gerador que esquece de declarar um não deve herdá-lo silenciosamente por suposição.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Esta página foi útil?