Django DocTools
A reusable Django application for document processing, analysis, and summarization using AI.
Features
- Document summarization based on context and document type
- Smart topic generation and analysis
- Support for PDF, DOC, and DOCX files
- Multiple AI providers: Google's Gemini, OpenAI GPT models, and AWS Bedrock
Installation
pip install django-doctools
Usage
- Add "doctools" to your INSTALLED_APPS setting:
INSTALLED_APPS = [
...
'doctools',
]
- Configure your preferred AI provider in settings.py:
# Choose your AI provider: "gemini", "openai", or "bedrock"
DOCTOOLS_AI_PROVIDER = "gemini"
# For Gemini
GEMINI_API_KEY = 'your-gemini-api-key'
# For OpenAI
OPENAI_API_KEY = 'your-openai-api-key'
OPENAI_MODEL_NAME = 'gpt-4o' # Optional, defaults to gpt-4o
# For AWS Bedrock
BEDROCK_MODEL_ID = 'anthropic.claude-v2'
BEDROCK_AWS_REGION_NAME = 'us-east-1'
BEDROCK_AWS_ACCESS_KEY_ID = 'your-aws-access-key'
BEDROCK_AWS_SECRET_ACCESS_KEY = 'your-aws-secret-key'
- Use the document processor in your views:
from doctools.processors import DocumentProcessor
def process_document(request):
context = request.POST.get('context')
doc_type = request.POST.get('doc_type')
topics = request.POST.getlist('topics', None)
document = request.FILES.get('document')
processor = DocumentProcessor()
result = processor.process(
document=document,
context=context,
doc_type=doc_type,
topics=topics
)
return JsonResponse(result)
Development
To contribute to this project:
- Clone the repository
- Install development dependencies:
pip install -e ".[dev]" - Run tests:
pytest
Metadata
Release files for django-doctools 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_doctools-0.1.0.tar.gz | 10.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_doctools-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.4 kB
Release files / django_doctools-0.1.0.tar.gz
| Download URL | django_doctools-0.1.0.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6617230ead19c1f5c46a677dc46ab7914158f6baf1cf033d6a884a8361cb20d8
|
|
BLAKE2b-256 checksum How to use checksums |
2009e0ed6e7a2248dbd1b50b6dabbe648d620f85e074e19f4d56c0aaaca108dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.1
|
Release files / django_doctools-0.1.0-py3-none-any.whl
| Download URL | django_doctools-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a8ba6eebbb98954a747edddcf5c9f60e12b6aebbb2fa036257bcd33ed66a5da6
|
|
BLAKE2b-256 checksum How to use checksums |
4cb48e8a69a9eba724076b019f4917d8ef1e08f816b65dff16cc8bfb05b84bc0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.1
|