Skip to main content

Python SDK for Kytchen - BYOLLM Context Orchestration

Project description

Kytchen Python SDK

Python client for Kytchen - BYOLLM Context Orchestration.

Installation

pip install kytchen

Quick Start

import asyncio
from kytchen_sdk import KytchenClient, Budget

async def main():
    # Initialize client
    client = KytchenClient(
        api_key="kyt_sk_...",
        base_url="http://localhost:8000",  # For self-hosted
    )

    # Upload a dataset
    dataset = await client.datasets.create("my-data", "document.txt")

    # Query with your own LLM key (BYOLLM)
    result = await client.query(
        query="What is the main topic?",
        dataset_ids=[dataset.id],
        provider="anthropic",
        provider_api_key="sk-ant-...",  # Your Anthropic key
        budget=Budget(max_iterations=10, max_cost_usd=0.50),
    )

    print(result.answer)

    await client.close()

asyncio.run(main())

Features

  • Async-first: Built on httpx for efficient async HTTP
  • BYOLLM: Bring your own LLM API key (Anthropic, OpenAI)
  • Streaming: Real-time query progress via SSE
  • Self-host ready: Works with Docker self-hosted instances
  • Type-safe: Full type hints and dataclasses

API Reference

KytchenClient

client = KytchenClient(
    api_key="kyt_sk_...",
    base_url="https://api.kytchen.dev",  # Optional
    timeout=60.0,  # Optional
)

Datasets

# Upload
dataset = await client.datasets.create("name", "path/to/file.txt")

# List
datasets = await client.datasets.list()

# Get
dataset = await client.datasets.get("dataset-id")

# Delete
await client.datasets.delete("dataset-id")

Query

# Standard query
result = await client.query(
    query="Your question",
    dataset_ids=["id1", "id2"],
    budget=Budget(max_cost_usd=0.50),
    provider="anthropic",
    provider_api_key="your-llm-key",
)

# Streaming query
async for event in client.query_stream(...):
    print(event.type, event.data)

Self-Hosting

For self-hosted Kytchen instances:

client = KytchenClient(
    api_key="kyt_sk_selfhost_dev_key_12345",
    base_url="http://localhost:8000",
)

See the Docker self-host guide for setup instructions.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kytchen_sdk-1.0.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kytchen_sdk-1.0.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file kytchen_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: kytchen_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for kytchen_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 68acc0d6a87a1630ceaeb481885de761dc85b01c31ced3902daac2e4af0c96ad
MD5 132d0c742bf9a2f0a84151b921de652d
BLAKE2b-256 0e418feba669b9c1aa3de0ccf7138b4669209c41a50f338a28f0aa5f2de75d56

See more details on using hashes here.

File details

Details for the file kytchen_sdk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: kytchen_sdk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for kytchen_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc3c14f4e7e0f5a4719f7dce32efb4f452a4d1c4369431aeba6c544624d8ed31
MD5 26650f7e2d66bff280515d0bd327ea87
BLAKE2b-256 7c4ba6d293773f1b5663e5c53c341a450ad21938063933928c407e81dd601f74

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page