Skip to main content

Generate Dataset

Start an asynchronous synthetic dataset generation pipeline. The endpoint returns immediately with a dataset_id for tracking generation progress.


Endpoint​

POST https://api.platform.knowledgator.com/datasets/generate/


Headers​

NameTypeDescription
KnowledgatorAPI-KeyStringYour API key
Content-TypeStringapplication/json

Request Body​

ParameterTypeRequiredDescription
nameStringYesName for the generated dataset.
promptStringYesGeneration prompt describing data characteristics.
typeStringYesDataset task type: ner, classification, or instruct-it.
num_samplesIntegerYesNumber of samples to generate.
domainsArray of StringsNoList of target domain contexts.
classesArray of StringsNoCategory labels (for classification).
entity_typesArray of StringsNoEntity types to annotate (for NER).
json_templateStringNoCustom JSON schema template for structured outputs.
ner_output_formatStringNoFormat for NER outputs (simple or tokenized).

Example Request Body​

{
"name": "financial_filings_ner",
"prompt": "SEC earnings release snippets with entity annotations",
"type": "ner",
"num_samples": 500,
"entity_types": ["revenue", "operating_income", "reporting_date"]
}

Response​

{
"dataset_id": "e128a1c4-9844-4899-88c2-3e289bfca721",
"status": "pending"
}

Response Fields​

  • dataset_id: Unique identifier for tracking the generated dataset.
  • status: Generation job status (initially pending).

Error Codes​

Status CodeDescription
201Created – Dataset generation pipeline created and started.
400Bad Request – Invalid task type or missing required parameters.
401Unauthorized – Invalid or missing API key.
403Forbidden – Quota exceeded or feature not included in plan.
500Internal Server Error – Server-side error starting the pipeline.

Example Usage​

SDK Usage​

💡 Dedicated SDK Guides: See Python SDK | TypeScript SDK

TypeScript / JavaScript​

import { createClient } from '@knowledgator/typescript-sdk';

const kg = createClient('YOUR_API_KEY');

const pipeline = await kg.datasets.generate({
name: "financial_filings_ner",
prompt: "SEC earnings release snippets with entity annotations",
type: "ner",
num_samples: 500,
entity_types: ["revenue", "operating_income", "reporting_date"]
});

console.log(`Dataset ID: ${pipeline.dataset_id}, Status: ${pipeline.status}`);

Python SDK​

from knowledgator import Knowledgator

kg = Knowledgator(api_key="YOUR_API_KEY")

pipeline = kg.datasets.generate(
name="financial_filings_ner",
prompt="SEC earnings release snippets with entity annotations",
type="ner",
num_samples=500,
entity_types=["revenue", "operating_income", "reporting_date"]
)

print(f"Dataset ID: {pipeline.dataset_id}, Status: {pipeline.status}")

Expected SDK Output​

Dataset ID: e128a1c4-9844-4899-88c2-3e289bfca721, Status: pending

Python (Requests)​

import requests

url = "https://api.platform.knowledgator.com/datasets/generate/"
headers = {
"KnowledgatorAPI-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
}

payload = {
"name": "financial_filings_ner",
"prompt": "SEC earnings release snippets with entity annotations",
"type": "ner",
"num_samples": 500,
"entity_types": ["revenue", "operating_income", "reporting_date"]
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())

Expected Response (Python Requests)​

{
"dataset_id": "e128a1c4-9844-4899-88c2-3e289bfca721",
"status": "pending"
}

cURL​

curl -X POST "https://api.platform.knowledgator.com/datasets/generate/" \
-H "KnowledgatorAPI-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "financial_filings_ner",
"prompt": "SEC earnings release snippets with entity annotations",
"type": "ner",
"num_samples": 500,
"entity_types": ["revenue", "operating_income", "reporting_date"]
}'

Expected Response (cURL)​

{
"dataset_id": "e128a1c4-9844-4899-88c2-3e289bfca721",
"status": "pending"
}