Spaces:
Running
Running
File size: 8,636 Bytes
aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | # Quick Start Guide - RagBot
Get up and running in **5 minutes**!
## Step 1: Prerequisites
Before you begin, ensure you have:
- **Python 3.11+** installed ([Download](https://www.python.org/downloads/))
- **Git** installed ([Download](https://git-scm.com/downloads))
- **FREE API Key** from one of:
- [Groq](https://console.groq.com/keys) - Recommended (Fast & Free)
- [Google Gemini](https://aistudio.google.com/app/apikey) - Alternative
**System Requirements:**
- 4GB+ RAM
- 2GB free disk space
- No GPU required
---
## Step 2: Installation
### Clone the Repository
```bash
git clone https://github.com/yourusername/RagBot.git
cd RagBot
```
### Create Virtual Environment
**macOS/Linux:**
```bash
python3 -m venv .venv
source .venv/bin/activate
```
**Windows:**
```powershell
python -m venv .venv
.venv\Scripts\activate
```
### Install Dependencies
```bash
pip install -r requirements.txt
```
β±οΈ *Takes about 2-3 minutes*
---
## Step 3: Configuration
### Copy Environment Template
```bash
cp .env.template .env
```
### Add Your API Keys
Open `.env` in your text editor and fill in:
**Option 1: Groq (Recommended)**
```bash
GROQ_API_KEY="your_groq_api_key_here"
LLM_PROVIDER="groq"
EMBEDDING_PROVIDER="google"
GOOGLE_API_KEY="your_google_api_key_here" # For embeddings
```
**Option 2: Google Gemini Only**
```bash
GOOGLE_API_KEY="your_google_api_key_here"
LLM_PROVIDER="gemini"
EMBEDDING_PROVIDER="google"
```
**How to get API keys:**
1. **Groq API Key** (FREE):
- Go to https://console.groq.com/keys
- Sign up (free)
- Click "Create API Key"
- Copy and paste into `.env`
2. **Google Gemini Key** (FREE):
- Go to https://aistudio.google.com/app/apikey
- Sign in with Google account
- Click "Create API Key"
- Copy and paste into `.env`
---
## Step 4: Verify Installation
Quick system check:
```bash
python -c "
from src.workflow import create_guild
print('Testing system...')
guild = create_guild()
print('β
Success! System ready to use!')
"
```
If you see "β
Success!" you're good to go!
---
## Step 5: Run Your First Analysis
### Interactive Chat Mode
```bash
python scripts/chat.py
```
**Try the example:**
```
You: example
```
The system will analyze a sample diabetes case and show you the full capabilities.
**Try your own input:**
```
You: My glucose is 185, HbA1c is 8.2, and cholesterol is 210
```
---
## Common Commands
### Chat Interface
```bash
# Start interactive chat
python scripts/chat.py
# Commands within chat:
example # Run demo case
help # Show all biomarkers
quit # Exit
```
### Python API
```python
from src.workflow import create_guild
# Create the guild
guild = create_guild()
# Analyze biomarkers
result = guild.run({
"biomarkers": {"Glucose": 185, "HbA1c": 8.2},
"model_prediction": {"disease": "Diabetes", "confidence": 0.87},
"patient_context": {"age": 52, "gender": "male"}
})
print(result)
```
### REST API (Optional)
```bash
# Start API server
cd api
python -m uvicorn app.main:app --reload
# Access API docs
# Open browser: http://localhost:8000/docs
```
---
## Troubleshooting
### Import Error: "No module named 'langchain'"
**Solution:** Ensure virtual environment is activated and dependencies installed
```bash
source .venv/bin/activate # or .venv\Scripts\activate on Windows
pip install -r requirements.txt
```
### Error: "GROQ_API_KEY not found"
**Solution:** Check your `.env` file exists and has the correct API key
```bash
cat .env # macOS/Linux
type .env # Windows
# Should show:
# GROQ_API_KEY="gsk_..."
```
### Error: "Vector store not found"
**Solution:** The vector store will auto-load from existing files. If missing:
```bash
# The system will create it automatically on first use
# Or manually by running:
python src/pdf_processor.py
```
### System is slow
**Tips:**
- Use Groq instead of Gemini (faster)
- Ensure good internet connection (API calls)
- Close unnecessary applications to free RAM
### API Key is Invalid
**Solution:**
1. Double-check you copied the full key (no extra spaces)
2. Ensure key hasn't expired
3. Try generating a new key
4. Check API provider's status page
---
## Next Steps
### Learn More
- **[Full Documentation](README.md)** - Complete system overview
- **[API Guide](docs/API.md)** - REST API documentation
- **[Contributing](CONTRIBUTING.md)** - How to contribute
- **[Architecture](docs/ARCHITECTURE.md)** - Deep dive into system design
### Customize
- **Biomarker Validation**: Edit `config/biomarker_references.json`
- **System Behavior**: Modify `src/config.py`
- **Agent Logic**: Explore `src/agents/`
### Run Tests
```bash
# Run unit tests (30 tests, no API keys needed)
.venv\Scripts\python.exe -m pytest tests/ -q \
--ignore=tests/test_basic.py \
--ignore=tests/test_diabetes_patient.py \
--ignore=tests/test_evolution_loop.py \
--ignore=tests/test_evolution_quick.py \
--ignore=tests/test_evaluation_system.py
# Run integration tests (requires Groq/Gemini API key)
.venv\Scripts\python.exe -m pytest tests/test_diabetes_patient.py -v
```
---
## Example Session
```
$ python scripts/chat.py
======================================================================
RagBot - Interactive Chat
======================================================================
You can:
1. Describe your biomarkers (e.g., 'My glucose is 140, HbA1c is 7.5')
2. Type 'example' to see a sample diabetes case
3. Type 'help' for biomarker list
4. Type 'quit' to exit
π§ Initializing medical knowledge system...
β System ready!
You: My glucose is 185 and HbA1c is 8.2
π Analyzing your input...
β
Found 2 biomarkers: Glucose, HbA1c
π§ Predicting likely condition...
β
Predicted: Diabetes (87% confidence)
π Consulting medical knowledge base...
π€ RAG-BOT:
Hi there! π
Based on your biomarkers, I've analyzed your results:
π΄ PRIMARY FINDING: Type 2 Diabetes (87% confidence)
π YOUR BIOMARKERS:
ββ Glucose: 185 mg/dL [HIGH] (Normal: 70-100)
ββ HbA1c: 8.2% [CRITICAL HIGH] (Normal: <5.7)
π¬ WHAT THIS MEANS:
Your elevated glucose and HbA1c indicate Type 2 Diabetes...
[continues with full analysis]
```
---
## Getting Help
- **Issues**: [GitHub Issues](https://github.com/yourusername/RagBot/issues)
- **Discussions**: [GitHub Discussions](https://github.com/yourusername/RagBot/discussions)
- **Documentation**: Check the [docs/](docs/) folder
---
## Quick Reference Card
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β RagBot Cheat Sheet β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β START CHAT: python scripts/chat.py β
β START API: cd api && uvicorn app.main:app --reload β
β RUN TESTS: pytest β
β FORMAT CODE: black src/ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β CHAT COMMANDS: β
β example - Demo diabetes case β
β help - List biomarkers β
β quit - Exit β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β SUPPORTED BIOMARKERS: 24 total β
β Glucose, HbA1c, Cholesterol, LDL Cholesterol, β
β HDL Cholesterol, Triglycerides, Hemoglobin, β
β Platelets, White Blood Cells, Red Blood Cells, β
β BMI, Systolic Blood Pressure, and more... β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β DETECTED DISEASES: 5 types β
β Diabetes, Anemia, Heart Disease, β
β Thalassemia, Thrombocytopenia β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
---
**Ready to analyze biomarkers? Let's go!**
|