Skip to main content

Embedded AI assistant for Django Admin with read-only ORM execution.

Project description

django-admin-ai-assistant

Reusable Django application with an embedded AI assistant inside Django Admin.

Installation

  1. Install package dependencies and the app:
pip install -e .
  1. Add apps in settings.py:
INSTALLED_APPS = [
    # ...
    "rest_framework",
    "django_ai_admin",
]
  1. Add URLs in root urls.py:
from django.urls import include, path

urlpatterns = [
    # ...
    path("ai-assistant/", include("django_ai_admin.urls")),
]
  1. Run migrations:
python manage.py migrate
  1. Optional settings in settings.py:
DJANGO_AI_ADMIN_URL_PREFIX = "ai-assistant"
DJANGO_AI_ADMIN_ADMIN_SITE = "backend.admin_site.admin_site"  # optional
DJANGO_AI_ADMIN_OPENAI_BASE_URL = "https://api.openai.com/v1"

Usage

1) Configure AI in Django Admin

  1. Log in as superuser.
  2. Open Admin -> Django Ai Admin -> AI configs.
  3. Create or edit the config record and fill:
    • provider: openai
    • api_key: your API key
    • model: for example gpt-4o-mini
    • temperature: for example 0.2
    • max_tokens: for example 1024
    • timeout_sec: for example 30
  4. Save.

2) Use the assistant

  1. Open any Django Admin page as a staff user.
  2. Click Open AI in the admin header.
  3. Start a new chat and ask a data question about your project models.
  4. Review response, result, and optional details (interpretation/explanation/code).

Docker Demo Project

A ready-to-run example project is included in example_project/ with simple polls models (Question, Choice) and admin integration.

From the repository root:

cd example_project
make dev

Then open:

  • http://localhost:8000/admin/
  • login: admin / admin

See example_project/README.md for details.

Release (PyPI)

Package metadata currently uses:

  • package name: django-admin-ai-assistant
  • version: 0.1.0

To publish from GitHub Actions:

  1. Create a PyPI API token and add it to repository secrets as PYPI_API_TOKEN.
  2. Make sure pyproject.toml version matches the release (for example 0.1.0).
  3. Create and push a tag:
git tag v0.1.0
git push origin v0.1.0

What happens automatically:

  • Release workflow builds sdist and wheel
  • creates a GitHub Release with attached artifacts
  • publishes to PyPI (if PYPI_API_TOKEN is configured)

Install command after publish:

pip install django-admin-ai-assistant==0.1.0

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

django_admin_ai_assistant-0.1.2.tar.gz (34.0 kB view details)

Uploaded Source

Built Distribution

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

django_admin_ai_assistant-0.1.2-py3-none-any.whl (41.3 kB view details)

Uploaded Python 3

File details

Details for the file django_admin_ai_assistant-0.1.2.tar.gz.

File metadata

File hashes

Hashes for django_admin_ai_assistant-0.1.2.tar.gz
Algorithm Hash digest
SHA256 7d54eace9001d389814cd8377065bd00c09c55286d18b1f9df3b5760b96dc86d
MD5 cdcb5e6b6ef01d1ad95100b8c73cff56
BLAKE2b-256 71333e92b694223e7ac5439a1d9918c8bb8fc12faf129dc7674c24ac11c13d77

See more details on using hashes here.

File details

Details for the file django_admin_ai_assistant-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_admin_ai_assistant-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e6b3a088ac3fce9540954e0480dcdf45093d6de41350422b88933ab05b26f10f
MD5 1d28f0a12be4ed7535ad2925d973fbc1
BLAKE2b-256 95adf2fe8138d9991fd0ed47d339bd8f4d98006a59022998644e8fe871bbae5f

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