Skip to content

ritkaarsingh30/pythonChatbot

Repository files navigation

🐍 Python RAG Chat (Flask + Gemini + FAISS)

A simple and elegant Retrieval-Augmented Generation (RAG) web app built with Flask, FAISS, and Google Gemini.
It allows you to chat with a local knowledge base of Python documentation, cheatsheets, and curated open-source libraries — all retrieved using semantic search.


Features

  • Semantic Search using FAISS + sentence-transformers embeddings
  • Context-aware Answers powered by Google Gemini (free-tier compatible)
  • Python Knowledge Base built from Markdown docs and public datasets
  • Lightweight Flask App with clean HTML + CSS frontend
  • Local RAG System — no external vector DB needed

📚 Data Sources

This RAG system is built using data from:

  1. Python Cheatsheet — general Python syntax, functions, modules, and usage examples.
  2. Hugging Face: dylanhogg/awesome-python Dataset — curated collection of Python projects and libraries with descriptions and metadata.

Both sources are used locally to create FAISS embeddings for semantic retrieval.


⚙️ Setup Instructions

Clone the repository

git clone <your-repo-url>
cd python-rag-chat

Create a virtual environment

Highly recomended to use venv:

python -m venv .venv
source .venv/bin/activate   # Linux / macOS
.venv\Scripts\activate      # Windows

Install dependencies

pip install -r requirements.txt

Add your Gemini API key

GOOGLE_API_KEY=your_free_tier_gemini_key_here

The free-tier Gemini API works perfectly for this project.

Build your FAISS index

Run this once to generate embeddings from your Markdown and JSON data:

python build_rag_index.py

This will create a FAISS index inside embeddings/faiss_index/. Note : its included in the repository so its optional.

Run the Flask RAG app

python app.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published