Django Polly
Django Polly enhances Django with Language Learning Model (LLM) capabilities, enabling AI-powered conversations, task automation, and other intelligent features in your Django projects. It uses familiar Django patterns and provides a flexible framework for customizing AI behaviors and supporting various LLM backends.
Features
LLM Management: Create and configure LLM instances (parrots)
SmartConversations: Engage in AI-powered conversations
WebSocket Support: Real-time communication for chat interfaces
Admin Interface: Easily manage parrots and conversations
Extensible: Designed to work with various LLM backends
Screenshots
Django Admin Parrot UI
Smart Conversations Table UI
Smart Chat UI
Usage
Smart Chat UI
To interact with Parrots in real-time using the built-in Chat UI, navigate to:
https://[hostname:port]/polly/smart-gpt-chat/<int:conversation_id>
Replace [hostname:port] with your server’s hostname and port, and <int:conversation_id> with the ID of the conversation you want to interact with.
Documentation
For full documentation, visit: https://django-polly.readthedocs.io
Quick Start
Install django-polly and its dependencies:
pip install django-pollyAdd “django_polly” and its dependencies to your INSTALLED_APPS setting in settings.py:
INSTALLED_APPS = [ 'daphne', # Add this before all django apps 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django_polly', # Add this after all django apps 'rest_framework', # Required for API views 'django_json_widget', # Required for JSON widget in admin (optional) # ... your other apps ... ]Configure ASGI in your project’s asgi.py:
import os from django.core.asgi import get_asgi_application from channels.routing import ProtocolTypeRouter from django_polly.routing import polly_asgi_routes os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'your_project.settings') # Get the Django ASGI application django_asgi_app = get_asgi_application() # Use the Django ASGI application for HTTP requests polly_asgi_routes["http"] = django_asgi_app # Create the final ASGI application application = ProtocolTypeRouter(polly_asgi_routes)Update your settings.py with the following:
# Add this to specify the ASGI application ASGI_APPLICATION = 'your_project.asgi.application' WSGI_APPLICATION = 'your_project.wsgi.application' # Add this for daphne CHANNEL_LAYERS = { 'default': { 'BACKEND': 'channels.layers.InMemoryChannelLayer' } } AI_MODELS_PATH = BASE_DIR / 'ai_models' # Add this to specify the path to store AI modelsInclude the django-polly URLconf in your project urls.py:
from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('polly/', include('django_polly.urls')), # ... other URL patterns ... ]Run migrations:
python manage.py migrateDownload an AI model (example using Qwen2):
python manage.py download_model "Qwen2-500M-Instruct-Q8_0.gguf" "https://huggingface.co/lmstudio-community/Qwen2-500M-Instruct-GGUF/resolve/main/Qwen2-500M-Instruct-Q8_0.gguf"Start the development server:
python manage.py runserverVisit http://127.0.0.1:8000/admin/ to create parrots and http://127.0.0.1:8000/polly/ to use django-polly.
Dependencies
Django Polly supports Python 3.8 and up, and is compatible with Django 4.2 and 5.0.
Contributing
We welcome contributions! To learn more about contributing, please read our contributing docs.
Support
If you’re having issues, please let us know by opening an issue on our GitHub repository.
For larger discussions, join our mailing list.
License
The project is licensed under the AGPL-3.0 license.
Metadata
Release files for django-polly 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_polly-0.0.5.tar.gz | 36.3 kB | Without provenance | Details for django_polly-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_polly-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for django_polly-0.0.5-py3-none-any.whl |
Total release size: 80.3 kB
Release files / django_polly-0.0.5.tar.gz
| Download URL | django_polly-0.0.5.tar.gz |
|---|---|
| Size | 36.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8b6ffcfa7b9592d80c7830cb4208f3e12813bae52467fc9e3ce9baeb37bc270
|
|
BLAKE2b-256 checksum How to use checksums |
7b4ca78c0c3c1c5447db06b1e12e38cdb0285ea21e457f239a59945698f0cb26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.9
|
Release files / django_polly-0.0.5-py3-none-any.whl
| Download URL | django_polly-0.0.5-py3-none-any.whl |
|---|---|
| Size | 44.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8146ae50526c6b128ac52ce38c6ae48425d3f831822ca5dca0b79af29b18d811
|
|
BLAKE2b-256 checksum How to use checksums |
1f34eac60f2a25b2fba2b0105b1fac11ba383ffb2930064a728d0e1921ac948f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.9
|
Security for django-polly 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.