Skip to main content

Multimodal RAG pipeline for low-compute, local, real-world deployment

Project description

RAG-LLM-API-Pipeline

A fully local GPU poor, multimodal Retrieval-Augmented Generation (RAG) system powered by open-source local LLMs. This pipeline is designed for operational technology environments to provide AI-assisted access to technical knowledge, manuals, and historical data — securely and offline, at min cost.


✅ Key Features

  • 🔍 Retrieval-Augmented Generation (RAG) using FAISS + SentenceTransformers
  • 🧠 Query handling via a local, open-source Large Language Model (LLM)
  • 📄 Supports multiple input formats:
    • PDFs
    • Plain text files
    • Images (OCR via Tesseract)
    • Audio files (.wav, .flac, .aiff)
    • Videos (.mp4 with audio extraction)
  • 💻 Interfaces:
    • Command Line Interface (CLI)
    • Local REST API (FastAPI)
  • 🛠️ Asset definition via YAML configuration
  • 🔐 Works in fully local environments after setup

✅ Works locally, GPU/CPU-friendly with configurable precision
✅ CLI, API and simple web UI included


📦 Installation

pip install rag-llm-api-pipeline

🛠️ Setup Instructions (Windows + Anaconda)

1. Create Python Environment

conda create -n rag_env python=3.10
conda activate rag_env

2. Install Dependencies

Via Conda (system-level tools):

conda install -c conda-forge ffmpeg pytesseract pyaudio

Via Pip (Python packages):

pip install -r requirements.txt

Ensure Tesseract is installed and in your system PATH. You can get it from https://github.com/tesseract-ocr/tesseract.


🚀 Usage

Please review the quickstart guide.


🐧 Setup Instructions (Linux)

1. Create Python Environment

python3 -m venv rag_env
source rag_env/bin/activate

Or with conda:

conda create -n rag_env python=3.10
conda activate rag_env

2. Install System Dependencies

sudo apt update
sudo apt install -y ffmpeg tesseract-ocr libpulse-dev portaudio19-dev

Optional: install language packs for OCR (e.g., tesseract-ocr-eng).

3. Install Python Packages

pip install -r requirements.txt

🔁 Running the Application on Linux

CLI

python cli/main.py --system Pump_A --question "What is the restart sequence for this machine?"

API Server

uvicorn rag_llm_api_pipeline.api.server:app --host 0.0.0.0 --port 8000

cURL Query

curl -X POST http://localhost:8000/query \
     -H "Content-Type: application/json" \
     -d '{"system": "Pump_A", "question": "What does error E204 indicate?"}'

📚 How it Works

  1. Index Building:

    • Files are parsed using loader.py.
    • Text chunks are embedded with MiniLM.
    • FAISS index stores embeddings for fast similarity search.
  2. Query Execution:

    • User provides a natural language question.
    • Relevant text chunks are retrieved from the index.
    • LLM generates an answer based on retrieved context.

🧠 Model Info

  • All models are open-source and run offline.

You can replace with any local-compatible Hugging Face model.


🔐 Security & Offline Use

  • No cloud or external dependencies required after initial setup.
  • Ideal for OT environments.
  • All processing is local: embeddings, LLM inference, and data storage.

📜 License

MIT License


📧 Contact

For issues, improvements, or contributions, please open an issue or PR.

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

rag_llm_api_pipeline-0.3.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

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

rag_llm_api_pipeline-0.3.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file rag_llm_api_pipeline-0.3.0.tar.gz.

File metadata

  • Download URL: rag_llm_api_pipeline-0.3.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for rag_llm_api_pipeline-0.3.0.tar.gz
Algorithm Hash digest
SHA256 9416d5813b20af7452e593af58dcb93d79a4bc7502bf9a012bbd1e6141c86857
MD5 7d1092b58b18e7bfbf84ca259cb4007a
BLAKE2b-256 e797957eaae1a09cc907946896590599a6dd6eb7995fc68a5dea4d6ff0d20a1e

See more details on using hashes here.

File details

Details for the file rag_llm_api_pipeline-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for rag_llm_api_pipeline-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8286a3a503fdbe03358a78b82edd27b0edd4d75efbc4b29f17eea6a254643044
MD5 3aac5a93d87284dcf94915d707b74847
BLAKE2b-256 f60a8a3593e9785af567892a3f229fab0cccea610feded7b1302d2151e9a5394

See more details on using hashes here.

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