Metadata-Version: 2.4
Name: django-ai-sdk
Version: 0.1.1a1
Summary: Django AI SDK is a library that provides tools and utilities for building AI-powered applications with Django. It includes features such as natural language processing, machine learning, and integration with popular AI frameworks.
Author: terminalkitten
License-Expression: BSD-3-Clause
Project-URL: Homepage, https://github.com/django-ai-sdk/django-ai-sdk
Project-URL: Repository, https://github.com/django-ai-sdk/django-ai-sdk
Project-URL: Issues, https://github.com/django-ai-sdk/django-ai-sdk/issues
Project-URL: Changelog, https://github.com/django-ai-sdk/django-ai-sdk/releases
Keywords: django,ai,assistant,rag,llm,streaming,sse
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: daphne>=4.2.2
Requires-Dist: django<6.1,>=5.2.6
Requires-Dist: django-environ>=0.13.0
Requires-Dist: django-ninja>=1.6.2
Requires-Dist: loguru>=0.7.3
Requires-Dist: mimetypes-magic>=0.4.30
Requires-Dist: pydantic>=2.13.4
Requires-Dist: python-magic>=0.4.27
Provides-Extra: all
Requires-Dist: django-ai-sdk[haystack,mcp,mistral,openai,rag,restframework]; extra == "all"
Provides-Extra: haystack
Requires-Dist: chroma-haystack>=4.3.0; extra == "haystack"
Requires-Dist: fastembed-haystack>=2.3.0; extra == "haystack"
Requires-Dist: haystack-ai>=2.30.0; extra == "haystack"
Requires-Dist: huggingface-hub>=1.17.0; extra == "haystack"
Requires-Dist: qdrant-haystack>=10.3.0; extra == "haystack"
Requires-Dist: sentence-transformers>=5.5.1; extra == "haystack"
Provides-Extra: mcp
Requires-Dist: mcp>=1.27.2; extra == "mcp"
Requires-Dist: mcp-haystack>=1.3.0; extra == "mcp"
Provides-Extra: mistral
Requires-Dist: mistralai>=2.4.9; extra == "mistral"
Provides-Extra: openai
Requires-Dist: openai>=2.41.0; extra == "openai"
Requires-Dist: openai-agents>=0.17.4; extra == "openai"
Provides-Extra: rag
Requires-Dist: bm25s>=0.3.9; extra == "rag"
Requires-Dist: nltk>=3.9.4; extra == "rag"
Provides-Extra: restframework
Requires-Dist: djangorestframework>=3.17.1; extra == "restframework"
Dynamic: license-file

# Django AI SDK

A Django SDK for building AI-powered applications with support for multiple LLM providers, RAG (Retrieval-Augmented Generation), and streaming responses.

## Project Status: Read This First

This is an **early preview**. We're actively iterating on the API and learning from real usage. Here's what that means for you:

- **Expect breaking changes**: APIs will shift as we find better patterns.
- **Migrations might be reset**: Don't rely on database schema stability between versions.
- **Not for production**: Use this for experimentation, prototypes, and side projects. Keep critical workloads elsewhere.
- **Watch the repo**: Things change quickly. Star & watch to stay in the loop.
- **Your feedback shapes the SDK**: Break things, open issues, tell us what hurts.

We'd love to have you along for the ride, just keep your seatbelt on.


## Install

```bash
pip install django-ai-sdk
```

Or with uv:

```bash
uv add django-ai-sdk
```

## Quick Start

### 1. Add to INSTALLED_APPS

```python
# settings.py
INSTALLED_APPS = [
    ...
    "django_ai_sdk",
]
```

Then run `python manage.py migrate`.

### 2. Define your assistant

```python
# assistants.py
from django_ai_sdk import Assistant

class HelpDeskAssistant(Assistant):
    name = "Help Desk"
    model = "gpt-4o"
    instructions = "You are a helpful support assistant."
```

### 3. Return a streaming response

```python
# views.py
from .assistants import HelpDeskAssistant

assistant = HelpDeskAssistant()

@router.post("/chat")
async def chat(request, payload: ChatRequest):
    return await assistant.as_view(
        payload.messages,
        thread_id=payload.thread_id,
    )
```

## Features

- **RAG Pipelines**: BM25, ChromaDB, and Qdrant hybrid search with query expansion.
- **Streaming Responses**: Built-in SSE streaming. Works with Vercel AI SDK protocol.
- **Conversation Storage**: Automatic message persistence. Thread-based history out of the box.
- **Tool Calling**: MCP, memory, and custom tools — all managed by your Assistant.
- **Reindexing**: Hot-reload documents. Cached embeddings with simple refresh API.

## Documentation

Full documentation and examples: [github.com/django-ai-sdk/django-ai-sdk](https://github.com/django-ai-sdk/django-ai-sdk)
