Skip to main content

Generate Dataset

Start an asynchronous synthetic dataset generation pipeline using the Knowledgator Python SDK.


Example Usage​

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"Pipeline started with ID: {pipeline['pipeline_id']}")

Async Example​

import asyncio
from knowledgator import Knowledgator

async def main():
kg = Knowledgator(api_key="YOUR_API_KEY")
pipeline = await kg.datasets.generate_async(
name="support_intent_classification",
prompt="User customer service inquiries categorized by issue type",
type="text-classification",
num_samples=250,
classes=["billing", "technical_support", "account_access", "cancellation"]
)
print("Pipeline result:", pipeline)

asyncio.run(main())

Expected Output​

Pipeline started with ID: e128a1c4-9844-4899-88c2-3e289bfca721

Response Object Structure​

{
"pipeline_id": "e128a1c4-9844-4899-88c2-3e289bfca721",
"status": "pending",
"name": "financial_filings_ner",
"num_samples": 500,
"message": "Dataset generation pipeline started successfully."
}