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": {}
}
]
}Crear generación
La secuencia components.md §6 D.1, en su orden: no se escribe nada antes de que el digest quede fijado, y el flujo de trabajo comienza solo después de que la fila se haya confirmado.
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": {}
}
]
}Autorizaciones
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>.
Encabezados
1 - 255Optional external end-user identifier forwarded by the API gateway.
Cuerpo
1 - 64Show child attributes
Show child attributes
Show child attributes
Show child attributes
Cada valor solo puede ser inferior al valor predeterminado del generador (api.md §3).
Show child attributes
Show child attributes
200100Respuesta
Respuesta Exitosa
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
El presupuesto de una ejecución: los default_limits del generador, o los efectivos como ctx.limits.
Sin valores predeterminados. Cada número aquí es un límite que la plataforma aplica y contra el que se puede facturar a quien llama, así que un generador que olvida especificar uno no debería heredar silenciosamente una suposición.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
¿Esta página le ayudó?