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.

Metadata

Release files for local-dir-rag 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for local-dir-rag 0.4.1
File Size Uploaded
local_dir_rag-0.4.1.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for local-dir-rag 0.4.1
File Interpreter ABI Platform
local_dir_rag-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.8 kB

Release files / local_dir_rag-0.4.1.tar.gz

Download URL local_dir_rag-0.4.1.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
52e766bd81ab8e256a95c12d73c41504df826a5a2cc9c3f1247b48cc7677d22d
BLAKE2b-256 checksum
How to use checksums
df9a94c1d72eb2149d2d6e457d336f77c93f6904b9cf3162d4f00566393c71fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2025.

Transparency log

Release files / local_dir_rag-0.4.1-py3-none-any.whl

Download URL local_dir_rag-0.4.1-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a153d0146f3014eb5c0b8d12c03e23c83c43a2db05252cb22c3877fe52b8efd8
BLAKE2b-256 checksum
How to use checksums
4812f6698acf59452118d8700363002d251b1cacb0a00232dbc98f30d57f7aff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release 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