Schémata
Vygenerovat schéma
Použití AI k vygenerování schématu ze vzorových dat.
POST
/
v1
/
schemas
/
generate
const schema = await client.schemas.generate({
sample_data: "Product: iPhone 15 Pro, Price: $999, Storage: 128GB...",
name: "Smartphones",
});
console.log(schema.name); // "Smartphones"
console.log(schema.columns); // AI-generated columns
schema = client.schemas.generate(
sample_data="Product: iPhone 15 Pro, Price: $999, Storage: 128GB...",
name="Smartphones",
)
print(schema["name"]) # "Smartphones"
print(schema["columns"]) # AI-generated columns
curl -X POST "https://hub.banditshq.com/api/v1/schemas/generate" \
-H "Authorization: Bearer lasso_..." \
-H "Content-Type: application/json" \
-d '{
"sample_data": "Product: iPhone 15 Pro, Price: $999, Storage: 128GB, Color: Natural Titanium, Weight: 187g\nProduct: Galaxy S24 Ultra, Price: $1299, Storage: 256GB, Color: Titanium Gray, Weight: 232g",
"name": "Smartphones"
}'
{
"id": "schema_gen123",
"name": "Smartphones",
"description": null,
"is_default": false,
"columns": [
{ "key": "product_name", "label": "Product Name", "type": "text", "required": true },
{ "key": "price", "label": "Price", "type": "number" },
{ "key": "storage", "label": "Storage", "type": "text" },
{ "key": "color", "label": "Color", "type": "text" }
],
"created_at": "2025-03-01T10:00:00.000Z",
"updated_at": "2025-03-01T10:00:00.000Z"
}
Tělo požadavku
string
povinné
Vzorek dat, která chcete extrahovat. Může to být surový text, řádky CSV nebo jakýkoli strukturovaný formát. AI je analyzuje a určí vhodné sloupce a typy. Zkráceno na 5 000 znaků.
string
Název pro vygenerované schéma. Pokud je vynechán, AI vygeneruje název na základě dat.
Odpověď
Vrací nově vytvořený objekt schématu s AI-generovanými definicemi sloupců (stejný tvar jako Získat schéma).const schema = await client.schemas.generate({
sample_data: "Product: iPhone 15 Pro, Price: $999, Storage: 128GB...",
name: "Smartphones",
});
console.log(schema.name); // "Smartphones"
console.log(schema.columns); // AI-generated columns
schema = client.schemas.generate(
sample_data="Product: iPhone 15 Pro, Price: $999, Storage: 128GB...",
name="Smartphones",
)
print(schema["name"]) # "Smartphones"
print(schema["columns"]) # AI-generated columns
curl -X POST "https://hub.banditshq.com/api/v1/schemas/generate" \
-H "Authorization: Bearer lasso_..." \
-H "Content-Type: application/json" \
-d '{
"sample_data": "Product: iPhone 15 Pro, Price: $999, Storage: 128GB, Color: Natural Titanium, Weight: 187g\nProduct: Galaxy S24 Ultra, Price: $1299, Storage: 256GB, Color: Titanium Gray, Weight: 232g",
"name": "Smartphones"
}'
{
"id": "schema_gen123",
"name": "Smartphones",
"description": null,
"is_default": false,
"columns": [
{ "key": "product_name", "label": "Product Name", "type": "text", "required": true },
{ "key": "price", "label": "Price", "type": "number" },
{ "key": "storage", "label": "Storage", "type": "text" },
{ "key": "color", "label": "Color", "type": "text" }
],
"created_at": "2025-03-01T10:00:00.000Z",
"updated_at": "2025-03-01T10:00:00.000Z"
}
AI automaticky rozpoznává typy sloupců. Například detekuje cenová pole jako
number, URL adresy jako url a seznamy hodnot jako tags nebo enum.⌘I
const schema = await client.schemas.generate({
sample_data: "Product: iPhone 15 Pro, Price: $999, Storage: 128GB...",
name: "Smartphones",
});
console.log(schema.name); // "Smartphones"
console.log(schema.columns); // AI-generated columns
schema = client.schemas.generate(
sample_data="Product: iPhone 15 Pro, Price: $999, Storage: 128GB...",
name="Smartphones",
)
print(schema["name"]) # "Smartphones"
print(schema["columns"]) # AI-generated columns
curl -X POST "https://hub.banditshq.com/api/v1/schemas/generate" \
-H "Authorization: Bearer lasso_..." \
-H "Content-Type: application/json" \
-d '{
"sample_data": "Product: iPhone 15 Pro, Price: $999, Storage: 128GB, Color: Natural Titanium, Weight: 187g\nProduct: Galaxy S24 Ultra, Price: $1299, Storage: 256GB, Color: Titanium Gray, Weight: 232g",
"name": "Smartphones"
}'
{
"id": "schema_gen123",
"name": "Smartphones",
"description": null,
"is_default": false,
"columns": [
{ "key": "product_name", "label": "Product Name", "type": "text", "required": true },
{ "key": "price", "label": "Price", "type": "number" },
{ "key": "storage", "label": "Storage", "type": "text" },
{ "key": "color", "label": "Color", "type": "text" }
],
"created_at": "2025-03-01T10:00:00.000Z",
"updated_at": "2025-03-01T10:00:00.000Z"
}

