Skip to content
proxi666Public

About

Local-first agentic RAG assistant for ROS 2

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

ROSBOT

ROSBOT is a local-first agentic RAG assistant for ROS 2. It combines a FastAPI streaming backend, a LangGraph reasoning workflow, hybrid ChromaDB/BM25 retrieval, Ollama-based generation, and a React chat interface.

Built by Siddhant Diwaker.

What It Does

  • Routes ROS 2 questions into general, code, and knowledge paths.
  • Rewrites follow-up questions into standalone retrieval queries.
  • Retrieves from a local ROS 2 corpus using semantic search and keyword search.
  • Grades retrieved context before generation to reduce noisy answers.
  • Streams responses over Server-Sent Events to the web UI.
  • Runs with local models by default through Ollama.

Architecture

flowchart TD
    U[User] --> UI[React UI]
    UI -->|SSE + REST| API[FastAPI API]
    API --> G[LangGraph Agent]
    G --> C[Contextualizer]
    C --> R{Router}
    R -->|general| L[Generator]
    R -->|code or knowledge| H[Hybrid Retriever]
    H --> V[ChromaDB]
    H --> B[BM25]
    H --> GR[Relevance Grader]
    GR --> L
    L --> O[Ollama LLM]
    L --> API
Loading

Repository Layout

ROSBOT/
├── src/                              # FastAPI, LangGraph, retrieval, indexing
├── frontend/                         # React/Vite chat interface
├── data_creation/dataset_creation_scripts/
│   ├── download_gitingest_1.py        # GitHub source ingestion
│   ├── filter_gitingest_2.py          # Source cleanup
│   ├── chunker_3.py                   # Chunk generation
│   ├── enricher_4.py                  # Metadata enrichment
│   ├── crawl_ros2_humble_web.py       # Optional web crawl
│   ├── build_ros2_books_dataset.py    # Optional book/document processing
│   └── merge_jsonl.py                 # Dataset merge helper
├── Dockerfile
├── rosbot                            # Container entrypoint
└── requirements*.txt

Generated datasets, books, vector stores, browser caches, environment files, and offline packs are intentionally ignored.

Requirements

  • Python 3.10+
  • Node.js 20+
  • Ollama
  • Docker, optional

Pull the default local model:

ollama pull qwen2.5-coder:7b

Backend Setup

git clone https://github.com/proxi666/ROSBOT.git
cd ROSBOT

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env

Create or mount a local vector store at ros2_rag_db_v2/. If you have JSONL files under data_creation/dataset/, build the index with:

python -m src.indexer
python -m src.build_bm25

Start the API:

python -m uvicorn src.server:app --host 0.0.0.0 --port 8000

Health check:

curl http://localhost:8000/health

Frontend Setup

cd frontend
npm install
npm run dev -- --host 0.0.0.0

Open http://localhost:5173.

Data Pipeline

Install optional data-building dependencies when you need to rebuild the corpus:

pip install -r requirements-data.txt

Typical flow:

python data_creation/dataset_creation_scripts/download_gitingest_1.py
python data_creation/dataset_creation_scripts/filter_gitingest_2.py --help
python data_creation/dataset_creation_scripts/chunker_3.py --help
python data_creation/dataset_creation_scripts/enricher_4.py --help
python data_creation/dataset_creation_scripts/merge_jsonl.py --input-dir data_creation/dataset
python -m src.indexer

Cloud-based enrichment and hosted LLM providers are optional:

pip install -r requirements-cloud.txt

The default runtime path does not require cloud APIs.

Docker

Build and run:

./deploy.sh

Run an existing image:

./run_only.sh

The container expects a vector store mounted at ./ros2_rag_db_v2 and connects to Ollama on the host through http://host.docker.internal:11434. Start Ollama and pull the model on the host before running the container.

Offline Pack

After building the Docker image, preparing ros2_rag_db_v2/, and pulling the Ollama model on the target machine:

./export_offline.sh

This creates rosbot_offline_pack/ with the image archive, vector store if present, and a startup script.

Configuration

Variable Default Description
HOST 0.0.0.0 API bind host
PORT 8000 API port
LLM_PROVIDER ollama Runtime provider
LLM_MODEL qwen2.5-coder:7b Ollama model
OLLAMA_BASE_URL http://localhost:11434 Ollama endpoint
DB_PERSIST_DIR ./ros2_rag_db_v2 ChromaDB and BM25 storage
COLLECTION_NAME ros2_unified Chroma collection
EMBEDDING_MODEL BAAI/bge-small-en-v1.5 Sentence-transformer model
EMBEDDING_DEVICE cuda Falls back to CPU if CUDA is unavailable

License

MIT

About

Local-first agentic RAG assistant for ROS 2

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages