Skip to main content

A powerful document query system using RAG and LLM technologies

Project description

DocuQuery AI

PyPI package 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.1.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.1-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

File details

Details for the file docuquery_ai-0.1.1.tar.gz.

File metadata

  • Download URL: docuquery_ai-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 fe2e4fb954e7568d0ed2a318de96208e74c2aec3436fdec5d091f67f1256c852
MD5 cc86e0eae2620fbe0fb898ff2cce76b2
BLAKE2b-256 62002559bd0dce983491604eae60fe5e45f384ba5f614d335c6143cc8ca1a935

See more details on using hashes here.

Provenance

The following attestation bundles were made for docuquery_ai-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: docuquery_ai-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eb5d060761742dc7763d6ceb2504ae2341aaa87f6b97e445b3c4c96773db4eb6
MD5 9d08f1ac4bcbc9553036951e7252572a
BLAKE2b-256 b98006d989c694310b112ee00f7e9793e19e13760d3405d3b1a9befc2e1aec2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for docuquery_ai-0.1.1-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