Skip to content

[Feature] Python SDK #5

@Siddhant-K-code

Description

@Siddhant-K-code

Summary

Create pip install distill-ai package for Python developers.

Motivation

80% of AI developers use Python. A native SDK unlocks LangChain, LlamaIndex, and direct OpenAI/Anthropic integrations.

Components

  • HTTP client wrapper - Sync client for Distill API
  • Async support - aiohttp-based async client
  • LangChain integration - Custom retriever with built-in dedup
  • LlamaIndex integration - Node postprocessor
  • Type hints - Full typing with py.typed marker

Package Structure

distill-python/
├── src/distill/
│   ├── __init__.py
│   ├── client.py          # Sync HTTP client
│   ├── async_client.py    # Async HTTP client
│   ├── types.py           # Pydantic models
│   ├── integrations/
│   │   ├── langchain.py   # LangChain retriever
│   │   └── llamaindex.py  # LlamaIndex postprocessor
│   └── py.typed
├── tests/
├── pyproject.toml
└── README.md

Usage Examples

# Basic usage
from distill import DistillClient

client = DistillClient(api_key="...")
result = client.dedupe(chunks=[...], threshold=0.15)

# Async
async with AsyncDistillClient(api_key="...") as client:
    result = await client.pipeline(chunks=[...])

# LangChain
from distill.integrations.langchain import DistillRetriever

retriever = DistillRetriever(
    base_retriever=vectorstore.as_retriever(),
    distill_client=client
)

Acceptance Criteria

  • Published to PyPI as distill-ai
  • Works with Python 3.9+
  • Async and sync APIs
  • Integration examples in README
  • 90%+ test coverage

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions