Spaces:
Running
Running
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)
- Git installed (Download)
- FREE API Key from one of:
- Groq - Recommended (Fast & Free)
- Google Gemini - Alternative
System Requirements:
- 4GB+ RAM
- 2GB free disk space
- No GPU required
Step 2: Installation
Clone the Repository
git clone https://github.com/yourusername/RagBot.git
cd RagBot
Create Virtual Environment
macOS/Linux:
python3 -m venv .venv
source .venv/bin/activate
Windows:
python -m venv .venv
.venv\Scripts\activate
Install Dependencies
pip install -r requirements.txt
β±οΈ Takes about 2-3 minutes
Step 3: Configuration
Copy Environment Template
cp .env.template .env
Add Your API Keys
Open .env in your text editor and fill in:
Option 1: Groq (Recommended)
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
GOOGLE_API_KEY="your_google_api_key_here"
LLM_PROVIDER="gemini"
EMBEDDING_PROVIDER="google"
How to get API keys:
Groq API Key (FREE):
- Go to https://console.groq.com/keys
- Sign up (free)
- Click "Create API Key"
- Copy and paste into
.env
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:
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
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
# Start interactive chat
python scripts/chat.py
# Commands within chat:
example # Run demo case
help # Show all biomarkers
quit # Exit
Python API
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)
# 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
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
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:
# 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:
- Double-check you copied the full key (no extra spaces)
- Ensure key hasn't expired
- Try generating a new key
- Check API provider's status page
Next Steps
Learn More
- Full Documentation - Complete system overview
- API Guide - REST API documentation
- Contributing - How to contribute
- Architecture - 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
# 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
- Discussions: GitHub Discussions
- Documentation: Check the 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!