CoolFace
Apppublic

Aigenthix/Graph_RAG7

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
QUICKSTART.md252 linesDownload Raw Back to root
1# Quick Start Guide โšก2 3Get your Graph RAG Chatbot running in 5 minutes!4 5## Prerequisites6 7- Groq API Key (free at https://console.groq.com)8- One of: Docker, Python 3.8+, or Hugging Face account9 10---11 12## ๐Ÿš€ Fastest Way: Docker Compose (Recommended)13 14### 1. Get API Key151. Visit https://console.groq.com162. Sign up/Login173. Click "API Keys" โ†’ Create new API key184. Copy the key19 20### 2. Configure21```bash22cd /path/to/project23cp .env.example .env24# Edit .env and paste your API key:25# GROQ_API_KEY=your_actual_key_here26```27 28### 3. Launch29```bash30docker-compose up -d31```32 33### 4. Access34Open browser: http://localhost:786035 36โœ… **Done!** Your app is running.37 38---39 40## Alternative: Local Python Setup41 42### 1. Create environment43```bash44python -m venv venv45source venv/bin/activate  # On Windows: venv\Scripts\activate46```47 48### 2. Install dependencies49```bash50pip install -r requirements.txt51```52 53### 3. Set API key54```bash55export GROQ_API_KEY="your_api_key_here"  # On Windows: set GROQ_API_KEY=...56```57 58### 4. Run app59```bash60python app.py61```62 63### 5. Access64Open: http://localhost:786065 66---67 68## Alternative: Hugging Face Spaces (No local setup!)69 70### 1. Create Space711. Go to https://huggingface.co/spaces722. Click "Create new Space"733. Select "Docker" SDK744. Fill in details โ†’ Create75 76### 2. Upload files77```bash78git clone https://huggingface.co/spaces/YOUR_USERNAME/graph-rag-chatbot79cd graph-rag-chatbot80cp /path/to/app.py .81cp /path/to/Dockerfile .82cp /path/to/requirements.txt .83cp -r /path/to/templates .84cp /path/to/.dockerignore .85git add -A86git commit -m "Initial upload"87git push88```89 90### 3. Add API key91In Space Settings โ†’ Repository secrets:92- Name: `GROQ_API_KEY`93- Value: your_api_key94 95โœ… **Done!** App deploys automatically96 97---98 99## Using the Application100 101### Upload Documents102 1031. Click the upload area (or drag & drop)1042. Select PDF, CSV, or TXT file1053. Watch the progress bar1064. Status changes: queued โ†’ processing โ†’ ready107 108### View Knowledge Graph109 1101. Click "๐Ÿ“ˆ View Full Graph" (appears when ready)1112. Or go to "Knowledge Graph" tab1123. Select document from dropdown113 114### Chat with Your Document115 1161. Select document from dropdown1172. Type your question1183. Click "Send" (or press Enter)1194. Read the answer!120 121---122 123## Test Files124 125### Quick CSV Test126Create `test.csv`:127```csv128Name,Role,Salary129Alice,Engineer,120000130Bob,Manager,110000131Carol,Designer,100000132```133 134Upload it and try asking:135- "Who is the highest paid?"136- "How many employees?"137- "What roles are in the data?"138 139---140 141## Troubleshooting142 143### "GROQ_API_KEY not found"144```bash145# Linux/Mac146echo "GROQ_API_KEY=your_key" >> .env147 148# Windows149echo GROQ_API_KEY=your_key >> .env150```151 152### Port 7860 in use?153```bash154# Find what's using it155lsof -i :7860  # Mac/Linux156netstat -ano | findstr :7860  # Windows157 158# Use different port159PORT=8000 python app.py160```161 162### Docker build fails?163```bash164# Clean and rebuild165docker-compose down166docker system prune -a167docker-compose up -d168```169 170### Model download slow?171The embedding model (~400MB) downloads once on first run. This is normal and can take 2-3 minutes. Subsequent runs are instant.172 173---174 175## Common Commands176 177```bash178# View logs179docker-compose logs -f180 181# Stop app182docker-compose down183 184# Restart185docker-compose restart186 187# See what's running188docker-compose ps189 190# Check file storage191ls -la data/192```193 194---195 196## Feature Overview197 198| Feature | Status | Notes |199|---|---|---|200| PDF Upload | โœ… | Up to 50MB |201| CSV Upload | โœ… | Auto-detected |202| TXT Upload | โœ… | Plain text |203| Knowledge Graph | โœ… | Auto-visualized |204| RAG Chat | โœ… | Uses Groq Mixtral |205| Real-time Updates | โœ… | Every 1.5s |206| Mobile UI | โœ… | Responsive |207| Multi-document | โœ… | Process in parallel |208| API Access | โœ… | JSON endpoints |209 210---211 212## API Quick Reference213 214```bash215# Upload file216curl -F "files=@document.pdf" http://localhost:7860/api/upload217 218# Get documents219curl http://localhost:7860/api/documents220 221# Query document222curl -X POST -H "Content-Type: application/json" \223  -d '{"query":"What is...?","document":"doc.pdf"}' \224  http://localhost:7860/api/query225 226# Delete document227curl -X DELETE http://localhost:7860/api/delete/doc.pdf228```229 230---231 232## Next Steps233 2341. โœ… App running locally? Perfect!2352. ๐Ÿ“ค Upload a test document2363. ๐Ÿ“ˆ View the knowledge graph2374. ๐Ÿ’ฌ Try asking a question2385. ๐Ÿš€ Deploy to production (HF Spaces)239 240---241 242## Need Help?243 2441. Check `README.md` for detailed docs2452. See `TESTING.md` for test cases2463. Review `space_config.md` for HF deployment2474. Check logs: `docker-compose logs -f`248 249---250 251**You're all set! ๐ŸŽ‰ Start exploring!**252