AI support for your django app.
Project description
django-ai-support
This library is powered by langchain and langgraph to make easy AI support for your online shop or any website you want to create with Django.
Get started
settings
Settings should be something like this
AI_SUPPORT_SETTINGS = {
"TOOLS": [],
"SYSTEM_PROMPT": "You are the supporter of a bookstore website.",
"LLM_MODEL": model,
}
TOOLS: tools are for your AI model.
SYSTEM_PROMPT: This is important for your AI support, but the default prompt is: You are the supporter of a bookstore website. As you see.
LLM_MODEL: your chat model. like this:
model = init_chat_model("gemini-2.5-flash", model_provider="google_genai")
Be careful: LLM_MODEL can not be None.
config
Additionally, you can integrate your tools within your apps and add them to TOOLS.
For example, I have an app with the name of book. and this is inside of my tools.py file:
from langchain_core.tools import tool
from .models import Book
@tool(description="this is to get list of book with a price")
def get_books_with_price(price:int) -> str:
"""
get book with input price
Args:
price (int): price. in dollars
Returns:
str: list of books.
"""
text = ""
for book in Book.objects.filter(price=price).select_related("author"):
book_detail = f"book name: {book.name}, book price: {book.price}, Author: {book.author.first_name} {book.author.last_name}"
text += book_detail + "\n"
return text
After that, I can add this tool easily. This is inside my apps.py file:
from django.apps import AppConfig
class BookConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'book'
def ready(self):
from .tools import get_books_with_price as my_tool
from django_ai_support.conf import append_tools
append_tools([my_tool])
read more about tool calling in langchain
API
Now, you can use the chat API to talk with your AI support:
from django.urls import path
from django_ai_support.views import ChatAiSupportApi
urlpatterns = [
path("ai/", ChatAiSupportApi.as_view())
]
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_ai_support-0.1.11.tar.gz.
File metadata
- Download URL: django_ai_support-0.1.11.tar.gz
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc94d8d93d2c7eb401f8865d2db57a5cd30e335a34c8b44e20e7dae098825c0d
|
|
| MD5 |
6f3825d1c693bf79d9b42e87bdf9b8f6
|
|
| BLAKE2b-256 |
c8e102b6d48e2b860d6d2fbf602053c1abc94d45c4f156595d5a70ece689f3e2
|
Provenance
The following attestation bundles were made for django_ai_support-0.1.11.tar.gz:
Publisher:
release-pypi.yml on EmadDeve20/django-ai-support
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_ai_support-0.1.11.tar.gz -
Subject digest:
fc94d8d93d2c7eb401f8865d2db57a5cd30e335a34c8b44e20e7dae098825c0d - Sigstore transparency entry: 963064639
- Sigstore integration time:
-
Permalink:
EmadDeve20/django-ai-support@ae45d8b88823a494d09df9f8f268b48db07ac62b -
Branch / Tag:
refs/tags/django-ai-support==0.1.11 - Owner: https://github.com/EmadDeve20
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@ae45d8b88823a494d09df9f8f268b48db07ac62b -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_ai_support-0.1.11-py3-none-any.whl.
File metadata
- Download URL: django_ai_support-0.1.11-py3-none-any.whl
- Upload date:
- Size: 20.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84a51643d1e13fe0e1bbb00e2973f94c4137ad84c73a98c81e3ba4b9da2f2a06
|
|
| MD5 |
a35daac314a2ef2913bf8368a6e2b921
|
|
| BLAKE2b-256 |
56dc74bcd295d78720741a3cf7633d0fed2520822c0f9e6d45fa85b8c8cbe888
|
Provenance
The following attestation bundles were made for django_ai_support-0.1.11-py3-none-any.whl:
Publisher:
release-pypi.yml on EmadDeve20/django-ai-support
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_ai_support-0.1.11-py3-none-any.whl -
Subject digest:
84a51643d1e13fe0e1bbb00e2973f94c4137ad84c73a98c81e3ba4b9da2f2a06 - Sigstore transparency entry: 963064642
- Sigstore integration time:
-
Permalink:
EmadDeve20/django-ai-support@ae45d8b88823a494d09df9f8f268b48db07ac62b -
Branch / Tag:
refs/tags/django-ai-support==0.1.11 - Owner: https://github.com/EmadDeve20
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@ae45d8b88823a494d09df9f8f268b48db07ac62b -
Trigger Event:
release
-
Statement type: