InterventionGPT is a RAG-based Streamlit application using ChromaDB and Hugging Face Llama 3.1 to generate engineering-grade road safety interventions for the National Road Safety Hackathon 2025 (IITM).
InterventionGPT is a Retrieval-Augmented Generation (RAG) system designed to scan a curated knowledge base of road safety problems and generate implementation-ready engineering interventions following Indian Roads Congress (IRC) standards. The system combines Streamlit for the UI, ChromaDB for vector storage and retrieval, SentenceTransformers for embeddings, and Llama 3.1 8B Instruct (Hugging Face) for technical intervention generation with a custom structured prompt enforcing engineering-grade output.
- Loads a custom road-safety knowledge base from
data/rag_database.txt. - Embeds text using
sentence-transformers/all-MiniLM-L6-v2. - Stores and retrieves context with persistent ChromaDB collections.
- Generates intervention reports using
meta-llama/Llama-3.1-8B-Instructvia the Hugging Face Inference API. - Enforces strict output structure including IRC references, dimensions, materials, and rationale.
- Designed specifically for the National Road Safety Hackathon 2025 – IIT Madras.
InterventionGPT/
│
├── app.py # Main Streamlit RAG application
├── chromadb_store/ # Persistent ChromaDB storage
├── data/
│ └── rag_database.txt # Road safety knowledge base (one entry per line)
├── .env # HF_API_KEY stored here
├── requirements.txt
└── README.md
-
Clone the repository:
git clone https://github.com/yugaaank/InterventionGPT cd InterventionGPT -
Install dependencies:
pip install -r requirements.txt
-
Add your Hugging Face API key by creating a
.envfile:HF_API_KEY=your_key_here
-
Add your knowledge base by placing your data inside
data/rag_database.txt, with one road safety issue per line.
streamlit run app.py-
Embedding
Each database entry is embedded usingsentence-transformers/all-MiniLM-L6-v2. -
Storage
Documents and embeddings are stored in a persistent ChromaDB collection namedlocal_knowledge_collection. -
Retrieval
Given a user query, the system returns the top‑N most similar chunks with similarity scores. -
LLM Generation
A structured engineering prompt is sent tometa-llama/Llama-3.1-8B-Instruct, which produces interventions with dimensions, signage specifications, materials, installation procedures, IRC references (e.g., 67–2012, 35–2015, SP:84–2019), engineering rationale, and next steps in a strict standardized format.
Input:
“Pedestrian crossings near a school lack visibility and signage.”
Output:
- Full structured engineering report tailored to the scenario.
- At least 3 interventions with dimensions, signage, and materials.
- Rationale and references to relevant IRC standards.
- Next actions and confidence level for each recommendation.
All key configuration options are editable inside the code:
FILE_PATH = "data/rag_database.txt"
COLLECTION_NAME = "local_knowledge_collection"
EMBEDDING_MODEL = "sentence-transformers/all-MiniLM-L6-v2"
LANGUAGE_MODEL = "meta-llama/Llama-3.1-8B-Instruct"- Map-based visualizations of interventions for better spatial understanding.
- Support for multi-modal inputs, such as images of roads and junctions.
- Auto-classification of problems using supervised ML models.
- Export of PDF engineering reports for submission and documentation.