Metadata-Version: 2.4
Name: django_ragamuffin
Version: 3.6.0.10
Summary: OpenAI-backed document retrieval and conversational querying for Django
Home-page: https://github.com/opentaproject/django_ragamuffin
Author: Stellan Östlund
Author-email: stellan.ostlund@gmail.com
License: MIT License
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 5.2
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: annotated-types>=0.7.0
Requires-Dist: anyio>=4.10.0
Requires-Dist: asgiref>=3.9.1
Requires-Dist: backports.tarfile>=1.2.0
Requires-Dist: build>=1.3.0
Requires-Dist: certifi>=2025.8.3
Requires-Dist: charset-normalizer>=3.4.3
Requires-Dist: distro>=1.9.0
Requires-Dist: Django<6.1,>=5.2.17
Requires-Dist: django-grappelli>=4.0.2
Requires-Dist: django-pytest>=0.2.0
Requires-Dist: djhtml>=3.0.9
Requires-Dist: docutils>=0.22
Requires-Dist: h11>=0.16.0
Requires-Dist: httpcore>=1.0.9
Requires-Dist: httpx>=0.28.1
Requires-Dist: id>=1.5.0
Requires-Dist: idna>=3.10
Requires-Dist: importlib_metadata>=8.7.0
Requires-Dist: iniconfig>=2.1.0
Requires-Dist: jaraco.classes>=3.4.0
Requires-Dist: jaraco.context>=6.0.1
Requires-Dist: jaraco.functools>=4.3.0
Requires-Dist: jiter>=0.10.0
Requires-Dist: keyring>=25.6.0
Requires-Dist: Markdown>=3.9
Requires-Dist: markdown-it-py>=4.0.0
Requires-Dist: markdown2>=2.5.4
Requires-Dist: mdurl>=0.1.2
Requires-Dist: more-itertools>=10.8.0
Requires-Dist: nh3>=0.3.0
Requires-Dist: openai>=3.6.0
Requires-Dist: packaging>=25.0
Requires-Dist: pip-autoremove>=0.10.0
Requires-Dist: pluggy>=1.6.0
Requires-Dist: psycopg2-binary>=2.9.10
Requires-Dist: pydantic>=2.11.7
Requires-Dist: pydantic_core>=2.33.2
Requires-Dist: Pygments>=2.19.2
Requires-Dist: pypandoc>=1.15
Requires-Dist: pyproject_hooks>=1.2.0
Requires-Dist: pytest>=8.4.2
Requires-Dist: pytest-django>=4.11.1
Requires-Dist: readme_renderer>=44.0
Requires-Dist: regex>=2025.9.1
Requires-Dist: requests>=2.32.5
Requires-Dist: requests-toolbelt>=1.0.0
Requires-Dist: rfc3986>=2.0.0
Requires-Dist: rich>=14.1.0
Requires-Dist: sniffio>=1.3.1
Requires-Dist: sqlparse>=0.5.3
Requires-Dist: tiktoken>=0.11.0
Requires-Dist: tqdm>=4.67.1
Requires-Dist: twine>=6.2.0
Requires-Dist: typing-inspection>=0.4.1
Requires-Dist: typing_extensions>=4.15.0
Requires-Dist: urllib3>=2.5.0
Requires-Dist: zipp>=3.23.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# django-ragamuffin

`django-ragamuffin` adds OpenAI-backed document retrieval and conversational
querying to Django applications. It supports assistant-specific instructions,
uploaded document collections, multimodal query context, reasoning models, and
optional Mathpix PDF extraction.

## Requirements

- Python 3.11 or newer
- Django 5.2.17 or newer, below Django 6.1
- OpenAI Python SDK 3.6.0 or newer
- PostgreSQL

## Installation

```bash
pip install django-ragamuffin
```

Add `grappelli` before Django's admin application, then add Ragamuffin and its
database router to your Django settings:

```python
INSTALLED_APPS = [
    "grappelli",
    "django.contrib.admin",
    # The rest of the Django applications...
    "django_ragamuffin",
]

DATABASE_ROUTERS = [
    "django_ragamuffin.db_routers.RagamuffinRouter",
]

DJANGO_RAGAMUFFIN_DB = "django_ragamuffin"
OPENAI_UPLOAD_STORAGE = "/subdomain-data/query"
USE_CHATGPT = True

AI_MODEL = "gpt-6.1-sol"
AI_MODELS = {
    "staff": AI_MODEL,
    "default": AI_MODEL,
}
EFFORT = "medium"
```

Configure the OpenAI API key in the process environment:

```bash
export OPENAI_API_KEY="..."
```

The package includes its Django migrations. Apply them only through the
deployment's approved database-migration procedure.

Add the application URLs:

```python
from django.urls import include, path

urlpatterns = [
    path("grappelli/", include("grappelli.urls")),
    path("django_ragamuffin/", include("django_ragamuffin.urls")),
]
```

## Optional Mathpix extraction

Set `USE_MATHPIX=True` and provide `APP_ID` and `APP_KEY` to enable Mathpix PDF
conversion. Without those credentials, Mathpix integration remains disabled.

## License

MIT
