Skip to main content

Local Directory RAG

A simple tool for Retrieval-Augmented Generation (RAG) using documents from your local filesystem.

Overview

Local Directory RAG allows you to:

  1. Create vector embeddings from your local documents (PDF, TXT)
  2. Query these documents using natural language, leveraging OpenAI's language models

Requirements

  • Python 3.13 or higher
  • OpenAI API key and other parameters (set in your .env file)

Installation

This project uses Poetry for dependency management.

  1. Install Poetry by following the instructions in the official documentation.

    Quick installation methods:

    # For Linux, macOS, Windows (WSL)
    curl -sSL https://install.python-poetry.org | python3 -
    
    # For Windows PowerShell
    (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -
    
  2. Install Project Dependencies

    # Clone the repository
    git clone https://github.com/sualeh/local-dir-rag.git
    cd local-dir-rag
    
  3. Install dependencies using Poetry

    poetry install --extras "dev"
    poetry show --tree
    

Configuration

Copy the ".env.example" file as ".env" in the project root. Update it with your OpenAI API key, location of your documents, and where you would like the vector database to be created.

Usage

  1. Create Vector Database

    poetry run python -m local_dir_rag.main embed --docs-directory /path/to/docs --vector-db-path /path/to/vector_db
    
  2. Query Documents

    poetry run python -m local_dir_rag.main query --vector-db-path /path/to/vector_db
    

Development and Testing

  1. Install dependencies, as above.

  2. Run all tests:

    poetry run pytest
    

    Or, run a single test:

    poetry run pytest tests/test_document_loader.py::test_load_document
    

Docker Compose Usage

You can also use Docker Compose for easier management of the Local RAG container:

  1. Clone the project, as described above.

  2. Configure the ".env" file as described above.

  3. Run the application using Docker Compose:

    # For embedding documents
    docker-compose run local-dir-rag embed
    
    # For querying documents
    docker-compose run local-dir-rag query
    

    You can also pass additional arguments:

    docker-compose run local-dir-rag embed --docs-directory /data/docs --vector-db-path /data/vector_db
    

This approach simplifies volume mounting and environment variable management, especially when working with the tool regularly.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

local_dir_rag-0.4.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

local_dir_rag-0.4.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file local_dir_rag-0.4.0.tar.gz.

File metadata

  • Download URL: local_dir_rag-0.4.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for local_dir_rag-0.4.0.tar.gz
Algorithm Hash digest
SHA256 1256c637a07737b788dda63603b3990e20419b2546a37877f4c424f72269519c
MD5 159948fff6b119215343c1dadb83a94b
BLAKE2b-256 288b001219996068f3463580b9be290076d3693e98e4d11943abc2df8cbf18e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for local_dir_rag-0.4.0.tar.gz:

Publisher: publish-pypi.yml on sualeh/local-dir-rag

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

File details

Details for the file local_dir_rag-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: local_dir_rag-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for local_dir_rag-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f4bb89ea3ba7fd5da5017dc41008a7d01a53d876feca1471aa4b63a5edab1fbd
MD5 90adce4e314a19cf7ab21572528cd915
BLAKE2b-256 5e42d564f18474fbc2dcd96fc1e709c82d716489f8b0834cf9cc4916e19c6f93

See more details on using hashes here.

Provenance

The following attestation bundles were made for local_dir_rag-0.4.0-py3-none-any.whl:

Publisher: publish-pypi.yml on sualeh/local-dir-rag

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

Release history Release notifications | RSS feed

0.4.1

2 files

This release

0.4.0 This release

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page