A powerful document query system using RAG and LLM technologies
Project description
DocuQuery AI
A powerful document query system that combines RAG (Retrieval-Augmented Generation) with structured data handling capabilities. Upload documents and interact with them through natural language queries.
Features
- Document Processing: Supports PDF, DOCX, PPTX, TXT, MD files
- Structured Data: Handles CSV, XLS, XLSX with direct data operations
- Vector Search: Automatic text chunking and embedding with FAISS
- Natural Language Queries: RAG for unstructured documents
- Google Vertex AI: Integration with Google's LLM and embedding models
- CLI Interface: Command-line tool for easy document management
- Python API: Clean programmatic interface for integration
Installation
Install from PyPI:
pip install docuquery-ai
For development with optional dependencies:
pip install docuquery-ai[dev,web]
For GPU acceleration (if you have CUDA):
pip install docuquery-ai[gpu]
Quick Start
1. Set up Google Cloud credentials
export GOOGLE_API_KEY="your-google-api-key"
export GOOGLE_PROJECT_ID="your-google-project-id"
2. Python API Usage
from docuquery_ai import DocumentQueryClient
# Initialize the client
client = DocumentQueryClient(
google_api_key="your-api-key",
google_project_id="your-project-id"
)
# Upload a document
result = client.upload_document("path/to/document.pdf")
print(f"Uploaded: {result['filename']}")
# Query the document
response = client.query("What are the main topics discussed?")
print(f"Answer: {response.answer}")
# List all documents
documents = client.list_documents()
for doc in documents:
print(f"- {doc['filename']} ({doc['file_type']})")
3. CLI Usage
Initialize DocuQuery AI:
docuquery init
Upload a document:
docuquery upload document.pdf
Query your documents:
docuquery query "What are the key findings?"
List uploaded documents:
docuquery list
Get help:
docuquery --help
Supported File Types
- Text Documents: PDF, DOCX, PPTX, TXT, MD
- Structured Data: CSV, XLS, XLSX
- Archives: Processing of multiple files
Advanced Usage
Custom Configuration
from docuquery_ai import DocumentQueryClient
client = DocumentQueryClient(
google_api_key="your-api-key",
google_project_id="your-project-id",
vector_store_path="./custom_vector_db",
temp_upload_folder="./custom_temp"
)
Query Specific Files
# Upload multiple files
file1_result = client.upload_document("report1.pdf")
file2_result = client.upload_document("data.xlsx")
# Query specific files
response = client.query(
"Compare the metrics between reports",
file_ids=[file1_result['file_id'], file2_result['file_id']]
)
Using with Different Users
# Upload documents for different users
client.upload_document("doc1.pdf", user_id="user_123")
client.upload_document("doc2.pdf", user_id="user_456")
# Query documents for specific user
response = client.query("Summarize the content", user_id="user_123")
Architecture
The system uses a hybrid approach:
- RAG Pipeline: For unstructured documents (PDF, DOCX, etc.)
- Direct Data Operations: For structured files (CSV, Excel)
- Vector Store: FAISS for semantic search
- LLM Integration: Google Vertex AI for query understanding and response generation
- Database: SQLite for metadata and file tracking
CLI Commands
docuquery init- Initialize configurationdocuquery upload <file>- Upload and process a documentdocuquery query "<question>"- Query uploaded documentsdocuquery list- List all uploaded documentsdocuquery delete <file_id>- Delete a documentdocuquery --help- Show help information
Development
Installing for Development
git clone https://github.com/saichowdary007/DocuQuery-AI.git
cd DocuQuery-AI
pip install -e .[dev]
Running Tests
pytest
Code Formatting
black src/
isort src/
Requirements
- Python 3.8+
- Google Cloud credentials (API key or service account)
- Internet connection for Google Vertex AI API calls
Environment Variables
GOOGLE_API_KEY- Google API key for Vertex AIGOOGLE_PROJECT_ID- Google Cloud project IDGOOGLE_LOCATION- Google Cloud location (default: us-central1)
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
Acknowledgments
- LangChain for RAG implementation
- Google Vertex AI for ML capabilities
- FAISS for vector search
- FastAPI for the web framework
Project details
Release history Release notifications | RSS feed
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 docuquery_ai-0.1.0.tar.gz.
File metadata
- Download URL: docuquery_ai-0.1.0.tar.gz
- Upload date:
- Size: 36.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ade337cdbae8efadea17bb6b7af5448a2dd4572dd3c8bc505837d16d043fe8f4
|
|
| MD5 |
89de539ac69f13c10ea2dd963579dde6
|
|
| BLAKE2b-256 |
7f251f1bb1dca34c2420e7d72213a4743ec51f696ff402ade0fc2f66b3000a07
|
Provenance
The following attestation bundles were made for docuquery_ai-0.1.0.tar.gz:
Publisher:
publish.yml on saichowdary007/docu-query
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
docuquery_ai-0.1.0.tar.gz -
Subject digest:
ade337cdbae8efadea17bb6b7af5448a2dd4572dd3c8bc505837d16d043fe8f4 - Sigstore transparency entry: 248984660
- Sigstore integration time:
-
Permalink:
saichowdary007/docu-query@d6ba6cbb7aa2396ea8cadf7a580ba9997b841fa5 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/saichowdary007
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d6ba6cbb7aa2396ea8cadf7a580ba9997b841fa5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file docuquery_ai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: docuquery_ai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 40.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49982a61ed25115e8ce090192463091ee21c9cfb33662b951e8597624ece6d8c
|
|
| MD5 |
fb637c4837fd2a2fd741a625de115920
|
|
| BLAKE2b-256 |
3e71e6baa3e38ee976c0c6a883cd6210ca42b528ee18d153101d356e0ad7c2d5
|
Provenance
The following attestation bundles were made for docuquery_ai-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on saichowdary007/docu-query
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
docuquery_ai-0.1.0-py3-none-any.whl -
Subject digest:
49982a61ed25115e8ce090192463091ee21c9cfb33662b951e8597624ece6d8c - Sigstore transparency entry: 248984668
- Sigstore integration time:
-
Permalink:
saichowdary007/docu-query@d6ba6cbb7aa2396ea8cadf7a580ba9997b841fa5 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/saichowdary007
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d6ba6cbb7aa2396ea8cadf7a580ba9997b841fa5 -
Trigger Event:
push
-
Statement type: