Skip to main content

A powerful document query system using RAG and LLM technologies

Project description

DocuQuery AI

PyPI version Python Support License: MIT

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 configuration
  • docuquery upload <file> - Upload and process a document
  • docuquery query "<question>" - Query uploaded documents
  • docuquery list - List all uploaded documents
  • docuquery delete <file_id> - Delete a document
  • docuquery --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 AI
  • GOOGLE_PROJECT_ID - Google Cloud project ID
  • GOOGLE_LOCATION - Google Cloud location (default: us-central1)

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Acknowledgments

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

docuquery_ai-0.1.0.tar.gz (36.4 kB view details)

Uploaded Source

Built Distribution

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

docuquery_ai-0.1.0-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

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

Hashes for docuquery_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ade337cdbae8efadea17bb6b7af5448a2dd4572dd3c8bc505837d16d043fe8f4
MD5 89de539ac69f13c10ea2dd963579dde6
BLAKE2b-256 7f251f1bb1dca34c2420e7d72213a4743ec51f696ff402ade0fc2f66b3000a07

See more details on using hashes here.

Provenance

The following attestation bundles were made for docuquery_ai-0.1.0.tar.gz:

Publisher: publish.yml on saichowdary007/docu-query

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for docuquery_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 49982a61ed25115e8ce090192463091ee21c9cfb33662b951e8597624ece6d8c
MD5 fb637c4837fd2a2fd741a625de115920
BLAKE2b-256 3e71e6baa3e38ee976c0c6a883cd6210ca42b528ee18d153101d356e0ad7c2d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for docuquery_ai-0.1.0-py3-none-any.whl:

Publisher: publish.yml on saichowdary007/docu-query

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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