--- title: RAG Chatbot Demo emoji: 🤖 colorFrom: blue colorTo: green sdk: gradio sdk_version: 6.13.0 python_version: '3.10' app_file: app.py pinned: false --- # Demo RAG Chatbot A Python demo chatbot that: - loads configuration from environment variables or `config.yaml` - scrapes the configured website - builds embeddings using HuggingFace models - retrieves relevant chunks (RAG) - generates answers using SambaNova API - returns formatted text output with citations ## Setup 1. Install dependencies: ```bash pip install -r requirements.txt ``` 2. Configure environment variables: - `SAMBANOVA_API_KEY`: your SambaNova API key - `WEBSITE`: the URL to scrape - `EMBEDDING_MODEL`: HuggingFace model (default: `sentence-transformers/all-MiniLM-L6-v2`) - `SYSTEM_PROMPT`: optional behavior prompt Or create `config.yaml` with these keys. ## Run CLI Mode ```bash python chatbot.py ``` Type a question and press Enter. Type `exit` to quit. ## Run with Gradio UI ```bash python app.py ``` Interactive web interface with real-time answers and citations display. ## Hugging Face Spaces For deployment on Hugging Face Spaces: 1. Set the following secrets in your Space settings: - `SAMBANOVA_API_KEY` - `WEBSITE` - `EMBEDDING_MODEL` (optional) - `SYSTEM_PROMPT` (optional) 2. The app will automatically use these environment variables.