{"id":28863138,"url":"https://github.com/sarmishra/python-rag-chatbot","last_synced_at":"2026-05-08T07:32:22.247Z","repository":{"id":299966093,"uuid":"1004695549","full_name":"sarmishra/Python-RAG-Chatbot","owner":"sarmishra","description":"Build an AI-powered chatbot using RAG (Retrieval-Augmented Generation) with Python, LangChain, ChromaDB, and OpenAI. It allows you to ask questions about documents, and receive context-aware, grounded responses with source citations.","archived":false,"fork":false,"pushed_at":"2025-06-19T06:31:37.000Z","size":140,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-19T07:26:41.163Z","etag":null,"topics":["chatgpt","chatgpt-api","chromadb","embeddings","langchain","python3","rag","rag-chatbot","streamlit"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sarmishra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-19T03:29:29.000Z","updated_at":"2025-06-19T06:31:40.000Z","dependencies_parsed_at":"2025-06-19T07:26:50.197Z","dependency_job_id":"db7a7cd9-2555-4e14-9989-83158cf6a28e","html_url":"https://github.com/sarmishra/Python-RAG-Chatbot","commit_stats":null,"previous_names":["sarmishra/python-rag-chatbot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sarmishra/Python-RAG-Chatbot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarmishra%2FPython-RAG-Chatbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarmishra%2FPython-RAG-Chatbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarmishra%2FPython-RAG-Chatbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarmishra%2FPython-RAG-Chatbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sarmishra","download_url":"https://codeload.github.com/sarmishra/Python-RAG-Chatbot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarmishra%2FPython-RAG-Chatbot/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260898761,"owners_count":23079263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatgpt","chatgpt-api","chromadb","embeddings","langchain","python3","rag","rag-chatbot","streamlit"],"created_at":"2025-06-20T07:02:01.086Z","updated_at":"2025-10-06T11:04:38.900Z","avatar_url":"https://github.com/sarmishra.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧠 RAG + LangChain: AI Chatbot for Docs\n\nBuild an AI-powered chatbot using **RAG (Retrieval-Augmented Generation)** with **Python**, **LangChain**, **ChromaDB**, **OpenAI**, and **Streamlit UI**. It allows you to ask questions about documents (such as PDFs, Markdown files, etc.) and receive context-aware, grounded responses with source citations.\n\n---\n\n## 🚀 Features\n\n- Chat with your local files (Markdown, text, etc.)\n- Uses RAG for more accurate, grounded answers\n- Generate responses using OpenAI's GPT models\n- Fast similarity search with ChromaDB\n- Source chunk citation for transparency\n- Run via command line or a clean Streamlit UI\n\n---\n\n## 🧰 Tech Stack\n\n- **Python**\n- **LangChain**\n- **ChromaDB**\n- **OpenAI (embeddings + LLM)**\n- **Streamlit** (for web UI)\n\n---\n\n## 💻 Setup Instructions\n\n### 1. Install Dependencies\n\n1. Run this command to install dependencies in the `requirements.txt` file.\n\n```python\npip install -r requirements.txt\n```\n\n### 2. Set Your OpenAI API Key\n\nCreate a .env file in the root directory and define your API Key's value there.\n\n```.env\nOPENAI_API_KEY=your_api_key_here\n```\n\n### 3. Create database\n\nCreate the Chroma DB.\n\n```python\npython create_database.py\n```\n\n---\n\n## ▶️ Usage\n\n### Option 1: Command Line Interface\n\nAsk questions from the terminal using:\n\n```bash\npython query_data.py \"How does Alice meet the Mad Hatter?\"\n```\n\n• Uses similarity search + relevance threshold (\u003e= 0.7)\n• Returns a formatted response and document sources\n\n### Option 2: Streamlit Web App\n\nLaunch the UI:\n\n```bash\nstreamlit run app.py\n```\n\nThen open http://localhost:8501 in your browser.\n• Enter a question in the input box\n• See the AI response and source documents instantly\n\n---\n\n## 🛠️ How It Works\n\n1. Load Documents: Preprocessed and stored in Chroma vector DB.\n2. Chunking: Large texts are split into ~1000-character chunks.\n3. Embedding: Uses OpenAI embeddings to convert text into vectors.\n4. Search: Uses vector similarity to retrieve relevant chunks.\n5. Prompting: Combines retrieved context and question into a prompt.\n6. LLM Response: Uses OpenAI Chat API to generate grounded answers.\n\n---\n\n## How to create an OpenAI API Key\n\n\u003e Need to set up an OpenAI account and generate the OpenAI key from here : [Create a new secret key](https://platform.openai.com/api-keys). We will need to make a payment for the OpenAI API to work.\n\n---\n\n## 🖼️ Preview\n\n![Landing Page](https://github.com/sarmishra/Python-RAG-Chatbot/blob/main/AI_Chatbot_UI.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsarmishra%2Fpython-rag-chatbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsarmishra%2Fpython-rag-chatbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsarmishra%2Fpython-rag-chatbot/lists"}