Local Open RAG Platform (LORP)

Naive RAG build using fully open-source materials meant to be run with a local model (ie. Ollama - Qwen3.5:4B)

View the Project on GitHub DPStella/local-rag

Local Open RAG Platform (LORP)

Local-first RAG prototype using Ollama, FAISS, and FastAPI


Overview

LORP is an early-stage local retrieval-augmented generation (RAG) project. The implemented path uses:

The project is a prototype, not a production-hardened or multi-agent platform. Framework integrations and features that are not implemented are identified as planned below.


Goals

The current implementation demonstrates:

Multi-agent orchestration, richer document ingestion, evaluation, monitoring, and deployment improvements remain planned work.

Implemented Architecture

flowchart LR
    A[User question] --> B[API]
    B --> C[RAG agent]
    C --> D[Retrieve context]
    D --> E[Local LLM]
    E --> F[Grounded answer]

    classDef input fill:#14314f,stroke:#60a5fa,stroke-width:2px,color:#e0f2fe;
    classDef process fill:#123a2b,stroke:#34d399,stroke-width:2px,color:#d1fae5;
    classDef retrieval fill:#3a2a17,stroke:#fbbf24,stroke-width:2px,color:#fef3c7;
    classDef output fill:#2d1d45,stroke:#a78bfa,stroke-width:2px,color:#f3e8ff;

    class A,B input;
    class C process;
    class D retrieval;
    class E,F output;

For the implemented API, agent, retrieval, model, and CLI paths, see the detailed runtime view.

Ingestion and Retrieval

The loader can discover PDF, DOCX, and HTML paths, but the index builder skips those formats. They are not yet supported end to end.

Agent, API, and CLI

Optional Containers

Planned Integrations


Project Structure

This interactive tree lists every tracked project file, excluding Git’s internal metadata. Entries marked planned are placeholders or stubs, not active implementations.

πŸ“¦ local-rag/
β”œβ”€β”€ .gitignore
β”œβ”€β”€ _config.yml
β”œβ”€β”€ LICENSE
β”œβ”€β”€ README.md
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ _layouts/
β”‚ └── default.html
β”œβ”€β”€ βš™οΈ config/
β”‚ β”œβ”€β”€ agents.yaml
β”‚ β”œβ”€β”€ models.yaml
β”‚ └── settings.yaml
β”œβ”€β”€ πŸ’Ύ data/
β”‚ β”œβ”€β”€ indexed/
β”‚ β”‚ β”œβ”€β”€ .gitkeep
β”‚ β”‚ └── FAISS.txt
β”‚ β”œβ”€β”€ indexes/ β€” planned: generated FAISS indexes are created here
β”‚ β”‚ └── .gitkeep
β”‚ β”œβ”€β”€ processed/
β”‚ β”‚ β”œβ”€β”€ .gitkeep
β”‚ β”‚ └── test.csv
β”‚ └── raw/
β”‚ β”œβ”€β”€ .gitkeep
β”‚ └── test.txt
β”œβ”€β”€ 🐳 docker/
β”‚ β”œβ”€β”€ api.Dockerfile
β”‚ β”œβ”€β”€ docker-compose.yaml
β”‚ β”œβ”€β”€ docker-compose.yml
β”‚ β”œβ”€β”€ ollama.Dockerfile
β”‚ └── webui.Dockerfile
β”œβ”€β”€ docs/
β”‚ └── lorp_runtime_flow.md
β”œβ”€β”€ src/
β”‚ β”œβ”€β”€ __init__.py
β”‚ β”œβ”€β”€ prompt_flow.py
β”‚ β”œβ”€β”€ πŸ€– agents/
β”‚ β”‚ β”œβ”€β”€ __init__.py
β”‚ β”‚ β”œβ”€β”€ base_agent.py
β”‚ β”‚ β”œβ”€β”€ knowledge_agent.py
β”‚ β”‚ β”œβ”€β”€ report_agent.py β€” planned: structured report agent
β”‚ β”‚ └── research_agent.py β€” planned: multi-step research agent
β”‚ β”œβ”€β”€ api/
β”‚ β”‚ β”œβ”€β”€ __init__.py
β”‚ β”‚ └── server.py
β”‚ β”œβ”€β”€ eval/
β”‚ β”‚ β”œβ”€β”€ __init__.py
β”‚ β”‚ └── rag_eval.py β€” planned: evaluation integration is a placeholder
β”‚ β”œβ”€β”€ ingestion/
β”‚ β”‚ β”œβ”€β”€ __init__.py
β”‚ β”‚ β”œβ”€β”€ build_index.py
β”‚ β”‚ β”œβ”€β”€ loaders.py
β”‚ β”‚ └── preprocess.py
β”‚ β”œβ”€β”€ llm/
β”‚ β”‚ β”œβ”€β”€ __init__.py
β”‚ β”‚ β”œβ”€β”€ embeddings.py
β”‚ β”‚ └── ollama_client.py
β”‚ β”œβ”€β”€ retrieval/
β”‚ β”‚ β”œβ”€β”€ __init__.py
β”‚ β”‚ β”œβ”€β”€ llamaindex_client.py
β”‚ β”‚ └── retrievers.py
β”‚ β”œβ”€β”€ 🧰 tools/ β€” planned: tool implementations are currently stubs
β”‚ β”‚ β”œβ”€β”€ __init__.py
β”‚ β”‚ β”œβ”€β”€ file_tool.py
β”‚ β”‚ β”œβ”€β”€ retrieval_tool.py
β”‚ β”‚ β”œβ”€β”€ sql_tool.py
β”‚ β”‚ └── web_search_tool.py
β”‚ └── πŸ–₯️ ui/
β”‚ β”œβ”€β”€ .gitkeep
β”‚ └── webui_integration.md β€” planned: UI integration has notes only
└── πŸ§ͺ tests/
β”œβ”€β”€ test_agent.py
β”œβ”€β”€ test_api.py
β”œβ”€β”€ test_ingestion.py
β”œβ”€β”€ test_prompt_flow.py
└── test_retrieval.py

Getting Started

1. Install Ollama and pull models

Install Ollama, then pull a chat model and the default embedding model:

ollama pull qwen3.5:4b
ollama pull nomic-embed-text

The direct Python/API defaults use qwen3.5:4b. Docker Compose defaults CHAT_MODEL to qwen2.5:14b; pull that model instead or set CHAT_MODEL to another model available in Ollama.

2. Install Python dependencies and build an index

pip install -r requirements.txt
python src/ingestion/build_index.py

The index command reads supported .txt and .md files from data/raw and also indexes the project README.md. It writes a FAISS index and metadata JSON under data/indexes/.

3. Start the API server

uvicorn src.api.server:app --reload

The interactive CLI is also available:

python -m src.prompt_flow

Optional: run with Docker Compose

From the repository root, start the Ollama, API, and Open WebUI containers:

docker compose -f docker/docker-compose.yml up --build

The Compose Ollama service has its own model volume and does not automatically pull models or build an index. Build the index with the direct Python setup first, then stop the host Ollama service before starting Compose because both use port 11434. Pull the required models into the Compose Ollama container:

docker compose -f docker/docker-compose.yml exec ollama ollama pull qwen2.5:14b
docker compose -f docker/docker-compose.yml exec ollama ollama pull nomic-embed-text

The API container reads the generated index from the mounted project data directory.

API endpoints


Implemented Features

The knowledge agent does not provide a separate document-summarization workflow. Open WebUI is included as a container; a project-specific RAG plugin or configured integration is not implemented.

Not Yet Implemented

The document loader can discover PDF, DOCX, and HTML files, but the index-building pipeline currently skips those formats.

Evaluation

src/eval/rag_eval.py is a placeholder. RAGAS, LlamaIndex evaluation, DeepEval, and quality metrics such as faithfulness or answer correctness are not currently wired up.

Deployment

Dockerfiles and a Compose definition are provided for Ollama, the API, and Open WebUI. This is a local-development setup, not a production deployment: authentication, a production CORS policy, and a custom WebUI integration are not configured.

Monitoring

The API can return retrieval/generation timing and Ollama token metrics with query responses. A Prometheus/Grafana stack, GPU/DCGM monitoring, and persistent metrics collection are not implemented.

Data and Security

Roadmap


License

GNU General Public License v3.0. See LICENSE.