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
| Name | Type | Description |
|---|---|---|
KnowledgatorAPI-Key | String | Your API key |
Content-Type | String | application/json |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
name | String | Yes | Name for the generated dataset. |
prompt | String | Yes | Generation prompt describing data characteristics. |
type | String | Yes | Dataset task type: ner, classification, or instruct-it. |
num_samples | Integer | Yes | Number of samples to generate. |
domains | Array of Strings | No | List of target domain contexts. |
classes | Array of Strings | No | Category labels (for classification). |
entity_types | Array of Strings | No | Entity types to annotate (for NER). |
json_template | String | No | Custom JSON schema template for structured outputs. |
ner_output_format | String | No | Format 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 (initiallypending).
Error Codes
| Status Code | Description |
|---|---|
201 | Created – Dataset generation pipeline created and started. |
400 | Bad Request – Invalid task type or missing required parameters. |
401 | Unauthorized – Invalid or missing API key. |
403 | Forbidden – Quota exceeded or feature not included in plan. |
500 | Internal 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"
}