Python SDK
The official Python client library for the Knowledgator API platform.
Installation
Install using your preferred package manager (Python 3.8+ supported):
pip install knowledgator
Or with Poetry:
poetry add knowledgator
Or run directly with uv:
uvx --from knowledgator python
Quickstart & Authentication
Obtain your API key from api.platform.knowledgator.com and set it in your environment:
export KG_API_KEY="your_api_key_here"
Initialize the client:
from knowledgator import Knowledgator
import os
kg = Knowledgator(api_key=os.getenv("KG_API_KEY"))
# Zero-shot classification example
response = kg.comprehend.it(
text="Earth is beautiful and rich with life",
labels=["science", "geography", "sports"]
)
print(response)
Async version:
import asyncio
from knowledgator import Knowledgator
async def main():
kg = Knowledgator()
response = await kg.comprehend.it_async(
text="Kyiv is an ancient capital",
labels=["history", "geography"]
)
print(response)
asyncio.run(main())
SDK Modules
The Python SDK mirrors the Knowledgator platform services:
- Comprehend-it (
kg.comprehend.it) - Extract-it (
kg.extract.it,kg.extract.relations,kg.extract.summary) - Instruct-it (
kg.instruct.it) - Datasets (
kg.datasets.list,kg.datasets.create,kg.datasets.generate_plan,kg.datasets.generate) - Fine-tuning (
kg.finetuning.start_training,kg.finetuning.get_training) - Open Models (
kg.model("model-id").predict) - Raw Data (
kg.datasets.list_data,kg.datasets.create_data)