--- title: "RAG Chatbot — GPT-5.1 + URLs / Files / Text" emoji: 🧠 colorFrom: indigo colorTo: blue sdk: gradio sdk_version: 5.49.1 app_file: app.py pinned: false short_description: GPT-5.1 RAG chatbot for URLs, files, and text sources --- # 🔍 RAG Chatbot — GPT-5.1 + URLs / Files / Text A universal Retrieval-Augmented Generation (RAG) chatbot powered by **OpenAI GPT-5.1** and **Gradio 5.49.1**, enabling users to inject their own knowledge in real time — via **URLs**, **uploaded files**, or **raw text blocks** — and query it conversationally. --- ## 🚀 Features - **OpenAI API key input** stored per session (no backend storage) - **GPT-5.1** model for chat; **text-embedding-3-large** for vector retrieval - Accepts: - Live **URLs** (auto-fetched text) - Uploaded **files** (`.txt`, `.md`, `.csv`, `.json`) - Custom **text areas** for notes or raw data - Interactive **presets** that auto-fill working examples (ZEN sites, policy QA, etc.) - **Retrieval debugging info** displayed transparently for testing relevance - **No external DB** — fully in-memory RAG layer for portability - Works in **Hugging Face Space**, **Google Colab**, or **local Python** --- ## 🧩 How It Works 1. Enter your **OpenAI API key** and click **Save**. 2. Add knowledge sources (URLs, uploads, or text). 3. Click **Build / Refresh Knowledge Base**. - Text is chunked → embedded via `text-embedding-3-large`. - Stored in memory as a lightweight vector index. 4. Ask questions — the system retrieves relevant chunks and constrains GPT-5.1 to answer **only from those** and your **system instructions**. --- ## 🧱 File Structure