Agentic-RagBot / QUICKSTART.md
Nikhil Pravin Pise
refactor: major repository cleanup and bug fixes
6dc9d46
|
raw
history blame
8.36 kB

πŸš€ 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:

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:

  1. Groq API Key (FREE):

  2. Google Gemini Key (FREE):


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:

  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

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 πŸ’¬


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! πŸš€