Spaces:
Sleeping
π Quick Start Guide - MediGuard AI RAG-Helper
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
from src.state import PatientInput
# Create the guild
guild = create_guild()
# Analyze biomarkers
result = guild.run(PatientInput(
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
# Quick test
python tests/test_basic.py
# Full evaluation
python tests/test_evaluation_system.py
Example Session π
$ python scripts/chat.py
======================================================================
π€ MediGuard AI RAG-Helper - 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 π
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MediGuard AI 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, HDL, Triglycerides β
β Hemoglobin, Platelets, WBC, RBC, and more... β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β DETECTED DISEASES: 5 types β
β Diabetes, Anemia, Heart Disease, β
β Thalassemia, Thrombocytopenia β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Ready to revolutionize healthcare AI? Let's go! π