diff --git a/.gitignore b/.gitignore index 929021bb41a5823eb1c8c7796e8af58f289b136f..4e9b36de8475a27a87e2db4667cf0557063510b9 100644 --- a/.gitignore +++ b/.gitignore @@ -207,6 +207,6 @@ marimo/_static/ marimo/_lsp/ __marimo__/ - +*.ipynb Lung Cancer Guidelines/ -#frontend/frontend/ + diff --git a/0.0.18 b/0.0.18 deleted file mode 100644 index 5791ecd41755d5f737465d698e2421c035a87d97..0000000000000000000000000000000000000000 --- a/0.0.18 +++ /dev/null @@ -1,2 +0,0 @@ -Defaulting to user installation because normal site-packages is not writeable -Requirement already satisfied: python-multipart in c:\users\moaze\appdata\roaming\python\python313\site-packages (0.0.9) diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md deleted file mode 100644 index 7044289c82091e0b0f0c3e579c8f5185dcc3759e..0000000000000000000000000000000000000000 --- a/DEPLOYMENT.md +++ /dev/null @@ -1,206 +0,0 @@ -# Hugging Face Deployment Guide - -## Overview -This guide explains how to deploy the Lung Cancer Clinical Decision Support System to Hugging Face Spaces. - -## Prerequisites -- Hugging Face account -- Git installed locally -- OpenAI API key (for the agent) -- GitHub Personal Access Token (for side effects storage) - -## Deployment Steps - -### 1. Create a New Hugging Face Space - -1. Go to [Hugging Face Spaces](https://huggingface.co/spaces) -2. Click "Create new Space" -3. Configure: - - **Space name**: `moazx-api` (or your preferred name) - - **License**: Choose appropriate license - - **SDK**: Docker - - **Hardware**: CPU Basic (or upgrade as needed) - -### 2. Configure Environment Variables - -In your Hugging Face Space settings, add these secrets: - -```bash -OPENAI_API_KEY=your_openai_api_key_here -GITHUB_TOKEN=your_github_token_here -GITHUB_REPO=your_username/your_repo_name -GITHUB_BRANCH=main -PORT=7860 -``` - -### 3. Deploy the Application - -#### Option A: Direct Push to Hugging Face - -```bash -# Clone your Hugging Face Space repository -git clone https://huggingface.co/spaces/YOUR_USERNAME/moazx-api -cd moazx-api - -# Copy all backend files -cp -r /path/to/backend/* . - -# Add and commit -git add . -git commit -m "Initial deployment" -git push -``` - -#### Option B: Using Hugging Face CLI - -```bash -# Install Hugging Face CLI -pip install huggingface_hub - -# Login -huggingface-cli login - -# Push to Space -huggingface-cli upload YOUR_USERNAME/moazx-api . --repo-type=space -``` - -### 4. Verify Deployment - -1. Wait for the Space to build (check the logs) -2. Once running, test the API: - - Visit: `https://YOUR_USERNAME-moazx-api.hf.space` - - Check health: `https://YOUR_USERNAME-moazx-api.hf.space/health` - - View docs: `https://YOUR_USERNAME-moazx-api.hf.space/docs` - -### 5. Deploy Frontend - -The frontend is configured to use the API at `https://moazx-api.hf.space`. - -#### Option A: Serve from the same Space -The frontend files are already in the `/frontend` directory and will be served automatically. - -#### Option B: Deploy to separate hosting -Deploy the frontend folder to: -- Netlify -- Vercel -- GitHub Pages -- Any static hosting service - -## API Endpoints - -Once deployed, your API will be available at: - -``` -Base URL: https://moazx-api.hf.space - -Endpoints: -- GET / - API information -- GET /health - Health check -- GET /health/initialization - Initialization status -- POST /auth/login - User login -- POST /auth/logout - User logout -- GET /auth/status - Authentication status -- GET /ask - Ask a question (non-streaming) -- GET /ask/stream - Ask a question (streaming) -- GET /export/{format} - Export conversation -``` - -## Frontend Configuration - -The frontend is already configured to use the Hugging Face API: - -```javascript -// In frontend/script.js -this.apiBase = 'https://moazx-api.hf.space'; -``` - -## Authentication - -The system uses session-based authentication: - -1. Default credentials (change in production): - - Username: `admin` - - Password: `admin123` - -2. To change credentials, update `api/routers/auth.py` - -## Monitoring - -Monitor your deployment: - -1. **Hugging Face Space Logs**: Check the logs tab in your Space -2. **API Health**: Monitor `/health` endpoint -3. **Initialization Status**: Check `/health/initialization` - -## Troubleshooting - -### Issue: Space fails to build -- Check Dockerfile syntax -- Verify all dependencies in requirements.txt -- Check Space logs for specific errors - -### Issue: API returns 500 errors -- Verify environment variables are set correctly -- Check that OPENAI_API_KEY is valid -- Review application logs - -### Issue: CORS errors in frontend -- Verify CORS middleware configuration in `api/middleware.py` -- Ensure frontend URL is in allowed origins - -### Issue: Slow initialization -- The system loads models in the background -- Check `/health/initialization` for status -- Consider upgrading to better hardware tier - -## Performance Optimization - -### For Better Performance: -1. Upgrade to GPU hardware tier (for faster embeddings) -2. Use persistent storage for cached data -3. Enable CDN for frontend assets - -### Memory Management: -- Current setup uses CPU-optimized models -- Faiss-cpu for vector search -- Sentence-transformers for embeddings - -## Security Considerations - -1. **Change default credentials** in production -2. **Rotate API keys** regularly -3. **Enable rate limiting** (already configured) -4. **Use HTTPS** (automatic on Hugging Face) -5. **Review CORS settings** for production - -## Updating the Deployment - -To update your deployment: - -```bash -# Make changes locally -git add . -git commit -m "Update description" -git push - -# Hugging Face will automatically rebuild -``` - -## Cost Considerations - -- **Free tier**: CPU Basic (limited resources) -- **Paid tiers**: Better performance and reliability -- **API costs**: OpenAI API usage (pay per token) - -## Support - -For issues: -1. Check Hugging Face Space logs -2. Review application logs at `/logs/app.log` -3. Test endpoints using `/docs` (Swagger UI) - -## Additional Resources - -- [Hugging Face Spaces Documentation](https://huggingface.co/docs/hub/spaces) -- [FastAPI Documentation](https://fastapi.tiangolo.com/) -- [Docker Documentation](https://docs.docker.com/) diff --git a/DEPLOYMENT_SUMMARY.md b/DEPLOYMENT_SUMMARY.md deleted file mode 100644 index f35ee5040d11ab9d8fca4efba9dd10ed3adae540..0000000000000000000000000000000000000000 --- a/DEPLOYMENT_SUMMARY.md +++ /dev/null @@ -1,296 +0,0 @@ -# Deployment Summary - Hugging Face Integration - -## Changes Made for Hugging Face Deployment - -### 1. Frontend Configuration (`frontend/script.js`) -**Changed:** -- Updated API base URL from `http://127.0.0.1:8000` to `https://moazx-api.hf.space` - -**Impact:** -- Frontend now connects to the deployed Hugging Face Space API -- Works seamlessly with the production backend - -### 2. Backend Configuration (`app.py`) -**Changed:** -- Updated host from `127.0.0.1` to `0.0.0.0` (bind to all interfaces) -- Updated port to use environment variable `PORT` (default: 7860) -- Disabled reload for production -- Configured for single worker deployment - -**Impact:** -- Backend now accepts connections from external sources -- Compatible with Hugging Face Spaces port configuration -- Optimized for production deployment - -### 3. CORS Middleware (`api/middleware.py`) -**Already Configured:** -- CORS middleware already includes `https://moazx-api.hf.space` -- Supports multiple origins for development and production -- Allows credentials for authentication - -**No changes needed** - already production-ready! - -### 4. Docker Configuration (`Dockerfile`) -**Already Configured:** -- Multi-stage build for optimized image size -- Exposes port 7860 (Hugging Face standard) -- Runs as non-root user for security -- Uses Python 3.11-slim for minimal footprint - -**No changes needed** - already production-ready! - -### 5. Environment Variables (`.env.example`) -**Updated:** -- Added comprehensive documentation for all environment variables -- Included GitHub storage configuration -- Added server configuration (PORT, HOST) -- Added CORS configuration -- Documented authentication credentials - -**Action Required:** -- Copy `.env.example` to `.env` and fill in your actual values -- Set these as secrets in Hugging Face Space settings - -### 6. Documentation -**Created/Updated:** -- `DEPLOYMENT.md` - Comprehensive deployment guide -- `README.md` - Updated with full feature list and usage instructions -- `.env.example` - Complete environment variable documentation - -## Deployment Checklist - -### ✅ Code Changes Complete -- [x] Frontend API endpoint updated -- [x] Backend configured for production -- [x] CORS properly configured -- [x] Docker configuration verified -- [x] Environment variables documented - -### 📋 Next Steps for Deployment - -1. **Prepare Hugging Face Space** - ```bash - # Create a new Space on Hugging Face - # Name: moazx-api - # SDK: Docker - # Hardware: CPU Basic (or better) - ``` - -2. **Set Environment Variables in Hugging Face** - Go to Space Settings → Variables and Secrets: - ``` - OPENAI_API_KEY=your_actual_key - GITHUB_TOKEN=your_github_token - GITHUB_REPO=username/repo - GITHUB_BRANCH=main - PORT=7860 - ``` - -3. **Deploy Code to Hugging Face** - ```bash - # Clone your HF Space - git clone https://huggingface.co/spaces/YOUR_USERNAME/moazx-api - cd moazx-api - - # Copy all backend files - cp -r /path/to/backend/* . - - # Commit and push - git add . - git commit -m "Initial deployment" - git push - ``` - -4. **Verify Deployment** - - Wait for build to complete (check logs) - - Test health endpoint: `https://moazx-api.hf.space/health` - - Test API docs: `https://moazx-api.hf.space/docs` - - Test frontend by opening `frontend/index.html` - -5. **Test Functionality** - - Login with credentials (admin/admin123) - - Ask a test question - - Verify citations are working - - Test export functionality - - Check streaming responses - -## File Structure for Deployment - -``` -backend/ -├── api/ -│ ├── __init__.py -│ ├── app.py # Main FastAPI application -│ ├── middleware.py # CORS, auth, rate limiting -│ ├── exceptions.py -│ ├── models.py -│ └── routers/ -│ ├── medical.py # Medical query endpoints -│ ├── health.py # Health check endpoints -│ ├── export.py # Export endpoints -│ └── auth.py # Authentication endpoints -├── core/ -│ ├── agent.py # LangChain agent configuration ⭐ -│ ├── tools.py # Agent tools -│ ├── retrievers.py # Hybrid search -│ ├── context_enrichment.py # Context page enrichment -│ ├── vector_store.py # FAISS vector store -│ └── ... -├── frontend/ -│ ├── index.html # Main UI -│ ├── script.js # Frontend logic ⭐ (updated) -│ ├── styles.css # Styling -│ └── login.html # Login page -├── data/ -│ ├── chunks.pkl # Preprocessed document chunks -│ └── medical_terms_cache.json -├── Dockerfile # Docker configuration -├── requirements.txt # Python dependencies -├── app.py # Entry point ⭐ (updated) -├── README.md # Documentation ⭐ (updated) -├── DEPLOYMENT.md # Deployment guide ⭐ (new) -├── .env.example # Environment variables ⭐ (updated) -└── .gitignore - -⭐ = Files modified/created for deployment -``` - -## Configuration Summary - -### API Endpoint -- **Production**: `https://moazx-api.hf.space` -- **Local Dev**: `http://localhost:7860` - -### Authentication -- **Default Username**: `admin` -- **Default Password**: `admin123` -- **⚠️ Change in production!** - -### Required Environment Variables -```bash -OPENAI_API_KEY=required -GITHUB_TOKEN=optional (for side effects) -GITHUB_REPO=optional -PORT=7860 -``` - -### Optional Environment Variables -```bash -LANGSMITH_API_KEY=optional (for tracing) -ALLOWED_ORIGINS=optional (auto-configured) -AUTH_USERNAME=optional (defaults to admin) -AUTH_PASSWORD=optional (defaults to admin123) -``` - -## Testing the Deployment - -### 1. Health Check -```bash -curl https://moazx-api.hf.space/health -``` - -Expected response: -```json -{ - "status": "healthy", - "timestamp": "2025-01-22T...", - "version": "1.0.0" -} -``` - -### 2. API Documentation -Visit: `https://moazx-api.hf.space/docs` - -### 3. Test Query (with authentication) -```bash -# Login first -curl -X POST https://moazx-api.hf.space/auth/login \ - -H "Content-Type: application/json" \ - -d '{"username":"admin","password":"admin123"}' \ - -c cookies.txt - -# Ask a question -curl -X GET "https://moazx-api.hf.space/ask?query=What%20is%20EGFR%20mutation&session_id=test123" \ - -b cookies.txt -``` - -## Troubleshooting - -### Issue: Build fails on Hugging Face -- Check Dockerfile syntax -- Verify requirements.txt has all dependencies -- Check Space logs for specific errors - -### Issue: API returns 500 errors -- Verify OPENAI_API_KEY is set correctly -- Check application logs in Space -- Verify data files (chunks.pkl) are present - -### Issue: Frontend can't connect -- Verify CORS settings in middleware.py -- Check that frontend is using correct API URL -- Test API endpoint directly first - -### Issue: Authentication fails -- Verify credentials in auth.py -- Check cookie settings -- Ensure HTTPS is being used - -## Performance Considerations - -### Current Setup -- **CPU-optimized**: Uses faiss-cpu and CPU-only PyTorch -- **Memory**: ~2-4GB RAM usage -- **Startup time**: 30-60 seconds (background initialization) - -### Optimization Options -1. **Upgrade to GPU tier** - Faster embeddings and inference -2. **Enable caching** - Cache frequently accessed documents -3. **Optimize chunk size** - Reduce memory footprint -4. **Use persistent storage** - Store vector index on disk - -## Security Checklist - -- [x] HTTPS enabled (automatic on Hugging Face) -- [x] Session-based authentication implemented -- [x] Rate limiting configured (100 req/min) -- [x] CORS properly configured -- [x] Input validation in place -- [ ] Change default credentials (TODO in production) -- [ ] Rotate API keys regularly (TODO) -- [ ] Enable monitoring/logging (TODO) - -## Monitoring - -### Key Metrics to Monitor -1. **API Response Time**: Check X-Process-Time header -2. **Error Rate**: Monitor 500 errors in logs -3. **Initialization Status**: `/health/initialization` endpoint -4. **OpenAI API Usage**: Monitor token consumption - -### Logs Location -- Hugging Face Space logs tab -- Application logs: `/logs/app.log` - -## Next Steps After Deployment - -1. **Test thoroughly** with real clinical questions -2. **Monitor performance** and optimize as needed -3. **Update documentation** with actual deployment URL -4. **Set up monitoring** and alerts -5. **Plan for scaling** if usage increases -6. **Regular updates** to medical guidelines -7. **Security audit** and credential rotation - -## Support Resources - -- **Deployment Guide**: See `DEPLOYMENT.md` -- **API Documentation**: Visit `/docs` on deployed Space -- **Hugging Face Docs**: https://huggingface.co/docs/hub/spaces -- **FastAPI Docs**: https://fastapi.tiangolo.com/ - ---- - -**Deployment Status**: ✅ Ready for Deployment - -All code changes are complete. Follow the deployment checklist to deploy to Hugging Face Spaces. diff --git a/Medical_AI_System_Prompts.docx b/Medical_AI_System_Prompts.docx new file mode 100644 index 0000000000000000000000000000000000000000..2e4aa16786c6c9cac5629d645cdb9accdfcca478 Binary files /dev/null and b/Medical_AI_System_Prompts.docx differ diff --git a/QUICK_DEPLOY.md b/QUICK_DEPLOY.md deleted file mode 100644 index 694d5c677f8137ee16be0ca88c9973e15a867698..0000000000000000000000000000000000000000 --- a/QUICK_DEPLOY.md +++ /dev/null @@ -1,100 +0,0 @@ -# Quick Deployment Guide - Hugging Face - -## 🚀 Deploy in 5 Steps - -### Step 1: Create Hugging Face Space -1. Go to https://huggingface.co/spaces -2. Click "Create new Space" -3. Settings: - - Name: `moazx-api` - - SDK: **Docker** - - Hardware: CPU Basic (minimum) - -### Step 2: Set Environment Variables -In Space Settings → Secrets, add: -``` -OPENAI_API_KEY=sk-...your-key... -GITHUB_TOKEN=ghp_...your-token... -GITHUB_REPO=username/repo-name -GITHUB_BRANCH=main -PORT=7860 -``` - -### Step 3: Push Code -```bash -# Clone your Space -git clone https://huggingface.co/spaces/YOUR_USERNAME/moazx-api -cd moazx-api - -# Copy all files from backend folder -cp -r /path/to/backend/* . - -# Commit and push -git add . -git commit -m "Deploy Lung Cancer Clinical Decision Support System" -git push -``` - -### Step 4: Wait for Build -- Watch the build logs in your Space -- Wait for "Running" status (30-60 seconds) - -### Step 5: Test -```bash -# Test health endpoint -curl https://YOUR_USERNAME-moazx-api.hf.space/health - -# Visit API docs -open https://YOUR_USERNAME-moazx-api.hf.space/docs -``` - -## ✅ Verification Checklist - -- [ ] Space is running (green status) -- [ ] `/health` returns `{"status": "healthy"}` -- [ ] `/docs` shows API documentation -- [ ] Can login with admin/admin123 -- [ ] Can ask a test question -- [ ] Streaming responses work -- [ ] Citations appear in answers - -## 🔧 Quick Fixes - -### Build Failed? -- Check Dockerfile syntax -- Verify all files are committed -- Check Space logs for errors - -### API Not Responding? -- Verify OPENAI_API_KEY is set -- Check Space logs -- Restart the Space - -### Frontend Can't Connect? -- Update `frontend/script.js` with your Space URL: - ```javascript - this.apiBase = 'https://YOUR_USERNAME-moazx-api.hf.space'; - ``` - -## 📱 Access Your Deployment - -- **API**: `https://YOUR_USERNAME-moazx-api.hf.space` -- **Docs**: `https://YOUR_USERNAME-moazx-api.hf.space/docs` -- **Health**: `https://YOUR_USERNAME-moazx-api.hf.space/health` - -## 🔐 Default Credentials - -- Username: `admin` -- Password: `admin123` - -**⚠️ Change these in production!** - -## 📚 Full Documentation - -- Detailed guide: `DEPLOYMENT.md` -- Complete summary: `DEPLOYMENT_SUMMARY.md` -- README: `README.md` - ---- - -**Need Help?** Check the full deployment guide in `DEPLOYMENT.md` diff --git a/README.md b/README.md index e386133dd5d2bd4f1afcb48eee089814bdb64374..67da9b2b4f0d2555fbb5b09f555ce1710b02a320 100644 --- a/README.md +++ b/README.md @@ -33,22 +33,16 @@ A specialized AI-powered clinical decision support system for thoracic oncologis ## 🚀 Deployment ### Live API -The API is deployed at: **https://moazx-api.hf.space** +The API is deployed at: **https://moazx-lung-cancer-ai-advisor.hf.space** ### Quick Start 1. **Access the API**: - - API Docs: https://moazx-api.hf.space/docs - - Health Check: https://moazx-api.hf.space/health + - API Docs: https://moazx-lung-cancer-ai-advisor.hf.space/docs + - Health Check: https://moazx-lung-cancer-ai-advisor.hf.space/health -2. **Use the Frontend**: - - Open `frontend/index.html` in a browser - - Login with credentials (default: admin/admin123) - - Start asking clinical questions -### Deploy Your Own Instance -See [DEPLOYMENT.md](DEPLOYMENT.md) for detailed deployment instructions. ## 📚 API Endpoints @@ -61,10 +55,22 @@ See [DEPLOYMENT.md](DEPLOYMENT.md) for detailed deployment instructions. - `POST /auth/login` - User login - `POST /auth/logout` - User logout - `GET /auth/status` - Check authentication status - +up ### Medical Queries -- `GET /ask?query={question}&session_id={id}` - Ask a question (non-streaming) -- `GET /ask/stream?query={question}&session_id={id}` - Ask a question (streaming) +- `POST /ask` - Ask a question (complete response) + ```json + { + "query": "What are the early symptoms of lung cancer?", + "session_id": "user_123_session_1699612345" + } + ``` +- `POST /ask/stream` - Ask a question (streaming response) + ```json + { + "query": "What are the treatment options?", + "session_id": "user_123_session_1699612345" + } + ``` ### Export - `GET /export/{format}?session_id={id}` - Export conversation (format: pdf, docx, txt) @@ -116,46 +122,6 @@ See `.env.example` for all configuration options: - `PORT`: Server port (default: 7860) - `ALLOWED_ORIGINS`: CORS allowed origins -### Authentication - -Default credentials (change in production): -- Username: `admin` -- Password: `admin123` - -Update in `api/routers/auth.py` or via environment variables. - -## 📖 Usage Examples - -### Using the API - -```python -import requests - -# Login -response = requests.post( - "https://moazx-api.hf.space/auth/login", - json={"username": "admin", "password": "admin123"} -) -cookies = response.cookies - -# Ask a question -response = requests.get( - "https://moazx-api.hf.space/ask", - params={ - "query": "What is the first-line treatment for EGFR-mutated NSCLC?", - "session_id": "my-session-123" - }, - cookies=cookies -) -print(response.json()["response"]) -``` - -### Using the Frontend - -1. Open `frontend/index.html` -2. Login with credentials -3. Type your clinical question -4. Receive evidence-based answers with citations ## 🏗️ Architecture @@ -178,10 +144,11 @@ print(response.json()["response"]) ## 📊 Response Format The agent provides: -- **Concise, targeted answers** for busy clinicians +- **Concise, evidence-based answers** for busy clinicians - **Inline citations** after each statement - **Comprehensive reference list** at the end -- **Structured formatting** for easy scanning +- **Structured markdown formatting** for easy scanning +- **Real-time streaming** for immediate feedback Example: ``` @@ -194,35 +161,3 @@ Example: **References:** (Source: NCCN.pdf, Pages: 45, 46, Provider: NCCN, Location: NSCLC Treatment Algorithm) ``` - -## 🔒 Security - -- Session-based authentication -- Rate limiting (100 requests/minute) -- CORS protection -- Input validation -- Secure cookie handling - -## 📝 License - -[Add your license here] - -## 🤝 Contributing - -Contributions are welcome! Please read the contributing guidelines first. - -## 📧 Support - -For issues or questions: -- Check the [DEPLOYMENT.md](DEPLOYMENT.md) guide -- Review API docs at `/docs` -- Open an issue on GitHub - -## 🙏 Acknowledgments - -Built with: -- FastAPI -- LangChain -- OpenAI -- FAISS -- Sentence Transformers diff --git a/api/__pycache__/__init__.cpython-311.pyc b/api/__pycache__/__init__.cpython-311.pyc index cb65a50ab03406298e49d56bebb50494d56d3423..793cdbd388fa6ddfa4dcfa8a7b1b3e43f0e81960 100644 Binary files a/api/__pycache__/__init__.cpython-311.pyc and b/api/__pycache__/__init__.cpython-311.pyc differ diff --git a/api/__pycache__/__init__.cpython-313.pyc b/api/__pycache__/__init__.cpython-313.pyc index 406ffdda0358429bff0a993d8f3b37d2d67d7ef1..163ed87d5e51330ba7d47be66a4bfc2932c91942 100644 Binary files a/api/__pycache__/__init__.cpython-313.pyc and b/api/__pycache__/__init__.cpython-313.pyc differ diff --git a/api/__pycache__/app.cpython-311.pyc b/api/__pycache__/app.cpython-311.pyc index 0fb5d8373f273822e222b57003b46b55147ee6b2..f2d092638b2d997acfcebc571c9feae62e24430d 100644 Binary files a/api/__pycache__/app.cpython-311.pyc and b/api/__pycache__/app.cpython-311.pyc differ diff --git a/api/__pycache__/app.cpython-313.pyc b/api/__pycache__/app.cpython-313.pyc index e520f1d1686d046e2759584a5eb924dc8675547f..1669f6868222aed99671de195826c00abb5706f6 100644 Binary files a/api/__pycache__/app.cpython-313.pyc and b/api/__pycache__/app.cpython-313.pyc differ diff --git a/api/__pycache__/exceptions.cpython-313.pyc b/api/__pycache__/exceptions.cpython-313.pyc index 634c98a53d59a029df6898223c47e13542509df4..e7b7f8280909744826e309cc6b5481a389b69a34 100644 Binary files a/api/__pycache__/exceptions.cpython-313.pyc and b/api/__pycache__/exceptions.cpython-313.pyc differ diff --git a/api/__pycache__/middleware.cpython-313.pyc b/api/__pycache__/middleware.cpython-313.pyc index becc263b45d3240e4e1b5ea9ae6d17dc739d3864..38c1a8cea8aa2429e717cbad3e693c544f236f21 100644 Binary files a/api/__pycache__/middleware.cpython-313.pyc and b/api/__pycache__/middleware.cpython-313.pyc differ diff --git a/api/__pycache__/models.cpython-313.pyc b/api/__pycache__/models.cpython-313.pyc index 4775bdcdb51c9d9f9e80a6aff18b453c96160388..3f6cf08ed22b769521da6461c417580bd9f83d88 100644 Binary files a/api/__pycache__/models.cpython-313.pyc and b/api/__pycache__/models.cpython-313.pyc differ diff --git a/api/app.py b/api/app.py index 14ef7cc3a495ad68bfa3ffee04d3aa4342987a5a..25760ce084ae255a477f413b88e89485747bfacd 100644 --- a/api/app.py +++ b/api/app.py @@ -31,7 +31,7 @@ logger = logging.getLogger(__name__) async def lifespan(app: FastAPI): """Application lifespan management with background initialization""" # Startup - logger.info("Starting Medical RAG AI Advisor API...") + logger.info("Starting Lung Cancer AI Advisor API...") # Start background initialization of heavy components try: @@ -46,13 +46,29 @@ async def lifespan(app: FastAPI): yield # Shutdown - logger.info("Shutting down Medical RAG AI Advisor API...") + logger.info("Shutting down Lung Cancer AI Advisor API...") # Create FastAPI application app = FastAPI( - title="Medical RAG AI Advisor API", - description="Professional API for medical information retrieval and advisory services", + title="Lung Cancer AI Advisor API", + description="""AI-Powered Lung Cancer Information & Support API + +This API provides intelligent responses to lung cancer-related queries using advanced AI and medical knowledge retrieval. + +**Key Features:** +- Intelligent Query Processing: AI agent automatically selects appropriate tools and data sources +- Session Management: Maintains conversation context across multiple queries +- Streaming Support: Real-time response streaming for better UX +- Medical Knowledge Base: Access to comprehensive lung cancer information + +**Main Endpoints:** +- POST /ask - Get complete AI response for a query +- POST /ask/stream - Stream AI response in real-time (recommended for better UX) +- GET /health - Check API health and initialization status +- POST /export/{format} - Export conversation history + +""", version="1.0.0", docs_url="/docs", redoc_url="/redoc", @@ -83,9 +99,9 @@ app.include_router(export.router) async def root(): """Root endpoint with API information""" return { - "name": "Medical RAG AI Advisor API", + "name": "Lung Cancer AI Advisor API", "version": "1.0.0", - "description": "Professional API for medical information retrieval and advisory services", + "description": "AI-powered advisor for lung cancer information and support", "docs": "/docs", "health": "/health", "endpoints": { diff --git a/api/exceptions.py b/api/exceptions.py index 95c2516858364cb87243a83fa631e0c5c9f267df..97033ea439a13ce76ad630d70e66a36886610f5b 100644 --- a/api/exceptions.py +++ b/api/exceptions.py @@ -1,5 +1,5 @@ """ -Exception handlers for Medical RAG AI Advisor API +Exception handlers for Lung Cancer AI Advisor API """ import logging from datetime import datetime diff --git a/api/middleware.py b/api/middleware.py index a1f4e7293fd5d994961b51f712c703c4178d5436..aaa19a36f00008aee8a73f49e0dceb2e06775816 100644 --- a/api/middleware.py +++ b/api/middleware.py @@ -1,5 +1,5 @@ """ -Middleware for Medical RAG AI Advisor API +Middleware for Lung Cancer AI Advisor API """ import time import logging @@ -147,7 +147,8 @@ def get_cors_middleware_config(): # Default to allowing Hugging Face Space and localhost # Include null for file:// protocol and common local development origins allowed_origins = [ - "https://moazx-api.hf.space", + "http://127.0.0.1:7860", + "https://huggingface.co", "http://localhost:8000", "http://127.0.0.1:8000", "http://localhost:5500", # Live Server default port @@ -160,7 +161,7 @@ def get_cors_middleware_config(): return { "allow_origins": allowed_origins, "allow_credentials": True, - "allow_methods": ["*"], - "allow_headers": ["*"], - "expose_headers": ["*"], + "allow_methods": ["GET", "POST", "PUT", "DELETE", "OPTIONS"], + "allow_headers": ["Content-Type", "Authorization", "Accept", "Origin", "X-Requested-With", "Cookie"], + "expose_headers": ["Set-Cookie"], } diff --git a/api/models.py b/api/models.py index 7bb69eac05a05b836a0e974aee4c4446fdc687f6..0749caca9d308610e4035cbf568478aa8a905e0b 100644 --- a/api/models.py +++ b/api/models.py @@ -1,5 +1,5 @@ """ -API Models and Schemas for Medical RAG AI Advisor +API Models and Schemas for Lung Cancer AI Advisor """ from pydantic import BaseModel, Field from typing import Optional, List, Dict, Any diff --git a/api/routers/__pycache__/__init__.cpython-311.pyc b/api/routers/__pycache__/__init__.cpython-311.pyc index b4c5c4f3e349ef4504df4e99e238873942efa62d..781c4b69c8ceedaa5d5123b5786e87cfb534cd64 100644 Binary files a/api/routers/__pycache__/__init__.cpython-311.pyc and b/api/routers/__pycache__/__init__.cpython-311.pyc differ diff --git a/api/routers/__pycache__/__init__.cpython-313.pyc b/api/routers/__pycache__/__init__.cpython-313.pyc index 9707ae7d0edf0b0691dabee3d38da574906057ae..46187834884ff47f80e56eac3b2dee7e4e6476ec 100644 Binary files a/api/routers/__pycache__/__init__.cpython-313.pyc and b/api/routers/__pycache__/__init__.cpython-313.pyc differ diff --git a/api/routers/__pycache__/health.cpython-313.pyc b/api/routers/__pycache__/health.cpython-313.pyc index e3aea619fea39b0e1b9bd73bc1d4a71b7de7a3eb..c7b2dae9691fd03f6314aa1826588a66ff453a4b 100644 Binary files a/api/routers/__pycache__/health.cpython-313.pyc and b/api/routers/__pycache__/health.cpython-313.pyc differ diff --git a/api/routers/__pycache__/medical.cpython-311.pyc b/api/routers/__pycache__/medical.cpython-311.pyc index 5f32b5c0907e6043f4e45aecf1780d13a4b62fd4..e450e46bbac4ff9cebd5f9914d0cb93179761d1b 100644 Binary files a/api/routers/__pycache__/medical.cpython-311.pyc and b/api/routers/__pycache__/medical.cpython-311.pyc differ diff --git a/api/routers/__pycache__/medical.cpython-313.pyc b/api/routers/__pycache__/medical.cpython-313.pyc index 9bc1a8035eeca7af012908553253caa4703f0949..a8968a883af188ffdf870c27a653c417d3bed2bd 100644 Binary files a/api/routers/__pycache__/medical.cpython-313.pyc and b/api/routers/__pycache__/medical.cpython-313.pyc differ diff --git a/api/routers/auth.py b/api/routers/auth.py index 7a246d1774f1c7342a34ee62a267f2c1a5599b2c..ce42b1cd343899f2d322a7c1971b1354c2b94484 100644 --- a/api/routers/auth.py +++ b/api/routers/auth.py @@ -100,6 +100,9 @@ async def login( """ Login endpoint - validates credentials and creates session """ + # Log login attempt + logger.info(f"Login attempt for username: {username}, Origin: {request.headers.get('origin')}") + # Verify credentials if not verify_credentials(username, password): logger.warning(f"Failed login attempt for username: {username}") @@ -107,18 +110,22 @@ async def login( # Create session token = create_session(username) + logger.info(f"Session created for user: {username}") # Set secure cookie - # In development (HTTP), use lax samesite and secure=False - # In production (HTTPS), use none samesite and secure=True - is_production = os.getenv("ENVIRONMENT", "development") == "production" + # Detect if we're running on HTTPS (Hugging Face Spaces use HTTPS) + is_https = request.url.scheme == "https" or request.headers.get("x-forwarded-proto") == "https" + + # For HTTPS (production/HF Spaces), use SameSite=None with Secure=True for cross-origin + # For HTTP (local dev), use SameSite=Lax with Secure=False + if is_https: + samesite = "none" + secure = True + else: + samesite = "lax" + secure = False - origin = request.headers.get("origin") - parsed_origin = urlparse(origin) if origin else None - is_cross_site = bool(parsed_origin and parsed_origin.hostname and parsed_origin.hostname != request.url.hostname) - is_https = request.url.scheme == "https" - samesite = "none" if (is_https and (is_production or is_cross_site)) else "lax" - secure = True if samesite == "none" else is_production + logger.info(f"Setting cookie with samesite={samesite}, secure={secure}, is_https={is_https}") response.set_cookie( key="session_token", @@ -126,7 +133,8 @@ async def login( httponly=True, max_age=SESSION_MAX_AGE, samesite=samesite, - secure=secure + secure=secure, + path="/" ) logger.info(f"Successful login for user: {username}") @@ -175,12 +183,18 @@ async def verify(session_token: Optional[str] = Cookie(None)): @router.get("/status") -async def status(session_token: Optional[str] = Cookie(None)): +async def status(request: Request, session_token: Optional[str] = Cookie(None)): """ Check authentication status without raising exception """ + logger.info(f"Status check - Cookie present: {session_token is not None}, Origin: {request.headers.get('origin')}") session_data = verify_session(session_token) + if session_data: + logger.info(f"Status check - Authenticated as: {session_data.get('username')}") + else: + logger.info("Status check - Not authenticated") + return { "authenticated": session_data is not None, "username": session_data.get("username") if session_data else None diff --git a/api/routers/health.py b/api/routers/health.py index 3066db99acfd3fac75423051d33b8cd44608c27b..1a27b6d32d1c3f7996b6308f485a7edc7d650584 100644 --- a/api/routers/health.py +++ b/api/routers/health.py @@ -3,11 +3,6 @@ Health Check and System Status Router """ from datetime import datetime from fastapi import APIRouter -import sys -import os - -# Add src to path for imports -sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) from api.models import HealthStatus, InitializationStatus @@ -23,28 +18,58 @@ async def health_check(): # Check agent availability try: - from agent import safe_run_agent + from core.agent import safe_run_agent components["agent"] = "healthy" except Exception: components["agent"] = "unhealthy" # Check vector store try: - from vector_store import VectorStore - components["vector_store"] = "healthy" - except Exception: + from core.vector_store import get_vector_store, load_vector_store + from core.background_init import is_initialization_complete + + # If initialization is complete, check the vector store directly + if is_initialization_complete(): + vector_store = get_vector_store() + if vector_store is not None: + components["vector_store"] = "healthy" + else: + # If vector store is None, try to load it + try: + loaded_store = load_vector_store() + if loaded_store is not None: + components["vector_store"] = "healthy" + else: + components["vector_store"] = "unhealthy" + except Exception as e: + logger.error(f"Failed to load vector store: {e}") + components["vector_store"] = "unhealthy" + else: + # If initialization is not complete, the vector store might not be ready yet + # but we'll check if it exists and can be loaded + try: + loaded_store = load_vector_store() + if loaded_store is not None: + components["vector_store"] = "healthy" + else: + components["vector_store"] = "initializing" + except Exception as e: + logger.warning(f"Vector store not ready yet: {e}") + components["vector_store"] = "initializing" + except Exception as e: + logger.error(f"Error checking vector store health: {e}") components["vector_store"] = "unhealthy" # Check data loaders try: - from data_loaders import load_pdf_documents + from core.data_loaders import load_pdf_documents components["data_loaders"] = "healthy" except Exception: components["data_loaders"] = "unhealthy" # Check tools try: - from tools import medical_guidelines_knowledge_tool + from core.tools import medical_guidelines_knowledge_tool components["tools"] = "healthy" except Exception: components["tools"] = "unhealthy" @@ -52,7 +77,7 @@ async def health_check(): # Check initialization status initialization_status = None try: - from background_init import ( + from core.background_init import ( is_initialization_complete, get_initialization_status, is_initialization_successful, @@ -130,8 +155,8 @@ async def get_version(): """ return { "version": "1.0.0", - "name": "Medical RAG AI Advisor API", - "description": "Professional API for medical information retrieval and advisory services", + "name": "Lung Cancer AI Advisor API", + "description": "AI-powered advisor for lung cancer information and support", "build_date": "2024-01-01" } diff --git a/api/routers/medical.py b/api/routers/medical.py index 1b56ecd9d26b369a0e9da638ddbc90b66f6729db..800e410541406f154ce0e618d9526139660a4b86 100644 --- a/api/routers/medical.py +++ b/api/routers/medical.py @@ -1,9 +1,11 @@ """ -Medical Query Router for RAG AI Advisor +Medical Query Router for Lung Cancer AI Advisor """ import asyncio +import inspect from fastapi import APIRouter, HTTPException from fastapi.responses import StreamingResponse +from pydantic import BaseModel, Field import sys import os @@ -15,18 +17,78 @@ from core.agent import safe_run_agent, safe_run_agent_streaming router = APIRouter(tags=["medical"]) -@router.get("/ask") -async def ask(query: str, session_id: str = "default"): +class QueryRequest(BaseModel): """ - Process a medical query - agent decides which tools to use + Request model for medical queries - Args: - query: The medical question or query - session_id: Optional session identifier for conversation continuity (default: "default") + Example: + { + "query": "What are the early symptoms of lung cancer?", + "session_id": "user_123_session_456" + } + """ + query: str = Field( + ..., + description="The medical question or query about lung cancer", + example="Give me the options for first line treatment for NSCLC?" + ) + session_id: str = Field( + ..., + description="Unique session identifier for conversation continuity. Use the same `session_id` to maintain context across multiple queries. Format: `user_{user_id}_session_{timestamp}`", + example="user_123_session_1699612345" + ) + + +@router.post( + "/ask", + summary="Ask a lung cancer question", +) +async def ask(request: QueryRequest): """ + Process a lung cancer-related medical query and return a complete response. + +The AI agent intelligently selects appropriate tools and data sources to provide +accurate, evidence-based information about lung cancer. + +Request Body: +- `query` (required): Your medical question about lung cancer +- `session_id` (required): Unique identifier to maintain conversation context + +Response: +- `response`: Complete AI-generated answer in markdown format +- `session_id`: Echo of the session identifier used + +Example Request: + { + "query": "What are the early symptoms of lung cancer?", + "session_id": "user_123_session_1699612345" + } + +Example Response: + { + "response": "Early symptoms of lung cancer may include...\n\n**Common Early Signs:**\n- Persistent cough...", + "session_id": "user_123_session_1699612345" + } + +Frontend Integration Tips: +- Use the same `session_id` for follow-up questions to maintain context +- Display response in markdown renderer for better formatting +- Show loading state while waiting for response +- Handle 500 errors gracefully with user-friendly messages + +Args: + request: QueryRequest containing query and session_id + +Returns: + Dictionary with response text and session_id + +Raises: + HTTPException: 500 if query processing fails +""" + try: - response = await safe_run_agent(user_input=query, session_id=session_id) - return {"response": response, "session_id": session_id} + response = await safe_run_agent(user_input=request.query, session_id=request.session_id) + return {"response": response, "session_id": request.session_id} except Exception as e: raise HTTPException( @@ -34,20 +96,60 @@ async def ask(query: str, session_id: str = "default"): detail=f"Error processing medical query: {str(e)}" ) +# Dedent the docstring so OpenAPI/Redoc renderers don't treat the +# indented lines as a markdown code block (leading 4-space indentation). +ask.__doc__ = inspect.cleandoc(ask.__doc__ or "") -@router.get("/ask/stream") -async def ask_stream(query: str, session_id: str = "default"): + +@router.post( + "/ask/stream", + summary="Ask a lung cancer question with streaming response", + +) +async def ask_stream(request: QueryRequest): """ - Process a medical query with streaming response - agent decides which tools to use + Process a lung cancer-related medical query with real-time streaming response. + + Recommended for frontend use - Provides better user experience by streaming + the response as it's generated, similar to ChatGPT. + + Request Body: + - `query` (required): Your medical question about lung cancer + - `session_id` (required): Unique identifier to maintain conversation context + + Response: + - Streaming text/markdown content + - Response is sent in chunks as it's generated + - Connection stays open until response is complete + + Example Request: + { + "query": "Explain the difference between small cell and non-small cell lung cancer", + "session_id": "user_123_session_1699612345" + } + + Frontend Integration Tips: + - Use the same `session_id` for follow-up questions to maintain context + - Display response in markdown renderer for better formatting + - Show loading state while waiting for response + - Render markdown progressively as chunks arrive + - Show typing indicator while streaming + - Handle 500 errors gracefully with user-friendly messages + Args: - query: The medical question or query - session_id: Optional session identifier for conversation continuity (default: "default") + request: QueryRequest containing query and session_id + + Returns: + StreamingResponse with text/markdown content + + Raises: + HTTPException: 500 if query processing fails """ async def event_stream(): try: chunk_buffer = "" - async for chunk in safe_run_agent_streaming(user_input=query, session_id=session_id): + async for chunk in safe_run_agent_streaming(user_input=request.query, session_id=request.session_id): chunk_buffer += chunk # Send chunks in reasonable sizes for smoother streaming @@ -64,3 +166,6 @@ async def ask_stream(query: str, session_id: str = "default"): yield f"Error: {str(e)}" return StreamingResponse(event_stream(), media_type="text/markdown") + +# Dedent streaming endpoint docstring for proper Markdown rendering in docs +ask_stream.__doc__ = inspect.cleandoc(ask_stream.__doc__ or "") diff --git a/app.py b/app.py index fa07d8d623350ab4bfb50b4b8a32b721e0b64ade..4c8fcfded930be1af63f2c6c612c10a908034277 100644 --- a/app.py +++ b/app.py @@ -1,5 +1,5 @@ """ -Startup script for Medical RAG AI Advisor API +Startup script for Lung Cancer AI Advisor API """ import sys import os diff --git a/backup/backup_20251022_110950/chunks.pkl b/backup/backup_20251022_110950/chunks.pkl deleted file mode 100644 index 8f1b8367c10c9630405313f36e5b76e4b590855b..0000000000000000000000000000000000000000 --- a/backup/backup_20251022_110950/chunks.pkl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b038845d797cac35024d39df8c7a861d741a1f7c2edc1a54286e17de1806b38e -size 3878660 diff --git a/backup/backup_20251022_110950/vector_store/index.faiss b/backup/backup_20251022_110950/vector_store/index.faiss deleted file mode 100644 index 46972b263d0e224f653ac1ef27396677fec665e0..0000000000000000000000000000000000000000 --- a/backup/backup_20251022_110950/vector_store/index.faiss +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:824156db2ada7613098cc7c9a8c27d66b33553885146fb6f66ab450ddc5d95cb -size 8248365 diff --git a/backup/backup_20251022_110950/vector_store/index.pkl b/backup/backup_20251022_110950/vector_store/index.pkl deleted file mode 100644 index becff6e3dba113ff75736a330c6df6cbb963ba54..0000000000000000000000000000000000000000 --- a/backup/backup_20251022_110950/vector_store/index.pkl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2655709226a3c13f4dae2efc131aaee81f68ac696a9b9a7aa8daeabc026d40d4 -size 4020637 diff --git a/backup/backup_20251022_111044/chunks.pkl b/backup/backup_20251022_111044/chunks.pkl deleted file mode 100644 index 8f1b8367c10c9630405313f36e5b76e4b590855b..0000000000000000000000000000000000000000 --- a/backup/backup_20251022_111044/chunks.pkl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b038845d797cac35024d39df8c7a861d741a1f7c2edc1a54286e17de1806b38e -size 3878660 diff --git a/backup/backup_20251022_111044/vector_store/index.faiss b/backup/backup_20251022_111044/vector_store/index.faiss deleted file mode 100644 index 46972b263d0e224f653ac1ef27396677fec665e0..0000000000000000000000000000000000000000 --- a/backup/backup_20251022_111044/vector_store/index.faiss +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:824156db2ada7613098cc7c9a8c27d66b33553885146fb6f66ab450ddc5d95cb -size 8248365 diff --git a/backup/backup_20251022_111044/vector_store/index.pkl b/backup/backup_20251022_111044/vector_store/index.pkl deleted file mode 100644 index becff6e3dba113ff75736a330c6df6cbb963ba54..0000000000000000000000000000000000000000 --- a/backup/backup_20251022_111044/vector_store/index.pkl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2655709226a3c13f4dae2efc131aaee81f68ac696a9b9a7aa8daeabc026d40d4 -size 4020637 diff --git a/core/__pycache__/__init__.cpython-311.pyc b/core/__pycache__/__init__.cpython-311.pyc index 379cad35e26d4e6777a14aaaba0f423a58f4ce7e..805e51e0542467b2f9d5b8db2a0906fd5e7304cb 100644 Binary files a/core/__pycache__/__init__.cpython-311.pyc and b/core/__pycache__/__init__.cpython-311.pyc differ diff --git a/core/__pycache__/__init__.cpython-313.pyc b/core/__pycache__/__init__.cpython-313.pyc index 266d16855a6788bf3f50a1e7ec3b9379d8682ec6..fa143100bc19ab0a078a84d50d5b55bc7113049d 100644 Binary files a/core/__pycache__/__init__.cpython-313.pyc and b/core/__pycache__/__init__.cpython-313.pyc differ diff --git a/core/__pycache__/agent.cpython-311.pyc b/core/__pycache__/agent.cpython-311.pyc index 99263c5d027a14107cb78b495b642953aebab312..3fa9fa212d5236abb4d1b4c4576138200de8bc2f 100644 Binary files a/core/__pycache__/agent.cpython-311.pyc and b/core/__pycache__/agent.cpython-311.pyc differ diff --git a/core/__pycache__/agent.cpython-313.pyc b/core/__pycache__/agent.cpython-313.pyc index 772ecf91e6fb3a031bc21bfff742776c896b6a19..a59c54f4975d6bef5787f6f0dfa4b89e4335fac4 100644 Binary files a/core/__pycache__/agent.cpython-313.pyc and b/core/__pycache__/agent.cpython-313.pyc differ diff --git a/core/__pycache__/background_init.cpython-313.pyc b/core/__pycache__/background_init.cpython-313.pyc index fe457c3e3dca57c24400849e550dcf1296437d32..dd4994570e3ffa83259aa5c5fc136c9d888b5008 100644 Binary files a/core/__pycache__/background_init.cpython-313.pyc and b/core/__pycache__/background_init.cpython-313.pyc differ diff --git a/core/__pycache__/config.cpython-311.pyc b/core/__pycache__/config.cpython-311.pyc index 74c28ebf07849f1d0a6fef5a8bec83616a132f59..8ad106d8707eed98919933201c45a0d4bc119c6c 100644 Binary files a/core/__pycache__/config.cpython-311.pyc and b/core/__pycache__/config.cpython-311.pyc differ diff --git a/core/__pycache__/config.cpython-313.pyc b/core/__pycache__/config.cpython-313.pyc index e0e229eed79e4a820121c14598a7e4f3556a553e..f5bc15e87aca65846339034e2e93854ce46f8fe2 100644 Binary files a/core/__pycache__/config.cpython-313.pyc and b/core/__pycache__/config.cpython-313.pyc differ diff --git a/core/__pycache__/data_loaders.cpython-313.pyc b/core/__pycache__/data_loaders.cpython-313.pyc index c49c9e360f70a7d2b0c2b35da4bf7d33348c77a6..e36b0cc9d9952decb1f0347294fac467161e20f5 100644 Binary files a/core/__pycache__/data_loaders.cpython-313.pyc and b/core/__pycache__/data_loaders.cpython-313.pyc differ diff --git a/core/__pycache__/github_storage.cpython-313.pyc b/core/__pycache__/github_storage.cpython-313.pyc index 8b5e63ab14723f6d5e592cfa63d0a340c400e09f..376a4995083c99035e7b9daa7a68ebfcb380335d 100644 Binary files a/core/__pycache__/github_storage.cpython-313.pyc and b/core/__pycache__/github_storage.cpython-313.pyc differ diff --git a/core/__pycache__/retrievers.cpython-313.pyc b/core/__pycache__/retrievers.cpython-313.pyc index 2763edb335910b38fcfb9d57e4d418909cbde6c2..d69f2707bccbb937106805a2d22d10e6a3ab9e5c 100644 Binary files a/core/__pycache__/retrievers.cpython-313.pyc and b/core/__pycache__/retrievers.cpython-313.pyc differ diff --git a/core/__pycache__/text_processors.cpython-313.pyc b/core/__pycache__/text_processors.cpython-313.pyc index 3bb3d7e5658801cf820fe6a1ccddd18845e8d6c3..3141ebe3a32cd9a56e97bc9b7d621ba307a5a668 100644 Binary files a/core/__pycache__/text_processors.cpython-313.pyc and b/core/__pycache__/text_processors.cpython-313.pyc differ diff --git a/core/__pycache__/tools.cpython-313.pyc b/core/__pycache__/tools.cpython-313.pyc index 6c39852b08b7b24e17e580e18146b08c21673730..70eae4dde35d22b245880140e745b8a90aca8896 100644 Binary files a/core/__pycache__/tools.cpython-313.pyc and b/core/__pycache__/tools.cpython-313.pyc differ diff --git a/core/__pycache__/tracing.cpython-313.pyc b/core/__pycache__/tracing.cpython-313.pyc index ad9dbd9a920b7766f1e891b05b0f35f45d17c6f5..6bee5fcaed697a33410521557f2ae423242a79f6 100644 Binary files a/core/__pycache__/tracing.cpython-313.pyc and b/core/__pycache__/tracing.cpython-313.pyc differ diff --git a/core/__pycache__/utils.cpython-313.pyc b/core/__pycache__/utils.cpython-313.pyc index d9c219c41b6d5a4986cdfde211adda1010e180a2..bbccea1739dd615e9173864a156e19e34f3e64fa 100644 Binary files a/core/__pycache__/utils.cpython-313.pyc and b/core/__pycache__/utils.cpython-313.pyc differ diff --git a/core/__pycache__/validation.cpython-313.pyc b/core/__pycache__/validation.cpython-313.pyc index ac89008f869f781beed480848b160f092f41261b..aebcb2732237cc3418ed9679a0e25923bb3f544e 100644 Binary files a/core/__pycache__/validation.cpython-313.pyc and b/core/__pycache__/validation.cpython-313.pyc differ diff --git a/core/agent.py b/core/agent.py index 8b73b75a48279adf04ef7ddf9624ca97b9e0b61c..1d9dbc77ab7b4d29e2412381fb11bb2ceea88015 100644 --- a/core/agent.py +++ b/core/agent.py @@ -4,6 +4,7 @@ from typing import Any, AsyncGenerator import asyncio import requests import os +import httpx from langchain.agents import create_openai_tools_agent, AgentExecutor from langchain.memory import ConversationBufferWindowMemory from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder @@ -101,22 +102,30 @@ Your primary purpose is to provide evidence-based clinical guidance on lung canc **AUDIENCE**: Your responses are for thoracic oncologists, pulmonologists, and medical experts managing lung cancer. Use appropriate medical terminology, clinical precision, and expert-level detail specific to lung cancer management. -**RESPONSE STYLE - CRITICAL: CONCISE, PRECISE, DOCTOR-SPECIFIC ANSWERS**: +**RESPONSE STYLE - CRITICAL: CONCISE, ACCURATE, MEDIUM-LENGTH ANSWERS FOR MEDICAL EXPERTS**: - **IMMEDIATE DIRECT ANSWERS**: Start immediately with the answer - NO introductory phrases like "I will retrieve...", "Let me search...", "Please hold on...", or status updates - **NO PREAMBLES**: Never announce what you're about to do - just do it and present the results directly - **ZERO PROCEDURAL STATEMENTS**: Do NOT write "I will retrieve", "I will search", "I will gather", "Please wait", "Hold on", or any similar phrases - START DIRECTLY WITH THE CLINICAL ANSWER - **FIRST WORD RULE**: Your response must begin with the actual answer content (e.g., a heading, clinical information, or direct statement) - never with a procedural announcement -- **CONCISE & TARGETED**: Provide focused, actionable answers directly addressing the clinical question -- **PRECISION OVER VOLUME**: Include only the most clinically relevant information - avoid unnecessary elaboration + +**RESPONSE LENGTH - MEDIUM AND BALANCED**: +- **NOT TOO LONG**: Avoid excessive detail, lengthy explanations, or exhaustive lists that overwhelm busy clinicians +- **NOT TOO SHORT**: Provide sufficient clinical context, key recommendations, and essential details for informed decision-making +- **MEDIUM LENGTH TARGET**: Aim for 200-400 words for standard queries; 400-600 words for complex multi-part questions +- **QUALITY OVER QUANTITY**: Every sentence must add clinical value - eliminate redundancy and filler content +- **CONCISE & COMPLETE**: Cover all essential aspects of the query without unnecessary elaboration + +**EXPERT-TAILORED CONTENT**: +- **PRECISION & ACCURACY**: Provide exact, evidence-based information from guidelines - no speculation or general knowledge - **CLINICAL EFFICIENCY**: Respect physicians' time by delivering key information first, then supporting details -- **STRUCTURED BREVITY**: Use clear hierarchical formatting (headers, bullet points) to enable rapid information scanning -- **ESSENTIAL DETAILS ONLY**: Include specific clinical parameters, dosing, biomarkers, and monitoring when directly relevant to the query +- **STRUCTURED CLARITY**: Use clear hierarchical formatting (headers, bullet points) to enable rapid information scanning +- **ESSENTIAL DETAILS**: Include specific clinical parameters, dosing, biomarkers, and monitoring when directly relevant to the query - **PRIORITIZED INFORMATION**: Lead with the most critical clinical decision points, contraindications, and evidence-based recommendations - **LUNG CANCER FOCUS**: Prioritize lung cancer-specific information including histology, molecular markers, staging, and treatment selection -- Use precise medical terminology without oversimplification -- Reference specific guideline sources (tables, figures, algorithms) with concise citations -- Highlight critical nuances, contraindications, and special populations only when clinically significant -- When multiple approaches exist, prioritize by evidence level and clinical context +- **MEDICAL TERMINOLOGY**: Use precise medical terminology appropriate for thoracic oncologists and pulmonologists +- **CONCISE CITATIONS**: Reference specific guideline sources (tables, figures, algorithms) with brief inline citations +- **CLINICALLY SIGNIFICANT NUANCES**: Highlight critical nuances, contraindications, and special populations only when clinically significant +- **EVIDENCE-BASED PRIORITIZATION**: When multiple approaches exist, prioritize by evidence level and clinical context - **CONTEXT AWARENESS**: Use context pages to ensure accuracy, but synthesize information concisely - **DIRECT ANSWERS**: Answer the specific question asked without providing tangential information @@ -129,6 +138,13 @@ Your primary purpose is to provide evidence-based clinical guidance on lung canc - Even for basic lung cancer concepts (e.g., "what is EGFR mutation", "ALK rearrangement", "PD-L1 expression"), you MUST retrieve information from the guidelines first - Only after retrieving guideline information should you formulate your answer based on what was retrieved +**STRICT QUERY ADHERENCE - ALL PROVIDERS REQUIREMENT:** +- When the user explicitly requests information from "all guidelines", "all providers", "according to all guidelines", or similar phrasing, you MUST retrieve and present information from ALL available guideline providers (NCCN, ASCO, ESMO, NICE, Manus) +- Do NOT selectively omit providers - if the user asks for "all", you must query each provider separately and include ALL results +- Call the medical_guidelines_knowledge_tool multiple times (once per provider) when "all providers" is requested +- Present a comprehensive answer that includes recommendations from every available provider +- If a specific provider has no information on the topic, explicitly state that in your response + **TOOL USAGE REQUIREMENTS:** 1. **MEDICAL QUESTIONS** (definitions, treatments, guidelines, etc.): - MANDATORY: Use "medical_guidelines_knowledge_tool" FIRST @@ -250,16 +266,19 @@ class SessionMemoryManager: def __init__(self): self._sessions = {} - self._default_window_size = 10 + self._default_window_size = 20 # Increased from 10 to maintain better context def get_memory(self, session_id: str = "default") -> ConversationBufferWindowMemory: """Get or create memory for a specific session.""" if session_id not in self._sessions: - self._sessions[session_id] = ConversationBufferWindowMemory( - memory_key="chat_history", - return_messages=True, - max_window_size=self._default_window_size - ) + import warnings + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", category=DeprecationWarning) + self._sessions[session_id] = ConversationBufferWindowMemory( + memory_key="chat_history", + return_messages=True, + max_window_size=self._default_window_size + ) return self._sessions[session_id] def clear_session(self, session_id: str) -> bool: @@ -359,7 +378,7 @@ def _perform_automatic_validation(user_input: str, response: str) -> None: """ try: # Import here to avoid circular imports - from .tools import _last_question, _last_documents, _last_user_question + from .tools import _last_question, _last_documents # Check if we have the necessary context for validation if not _last_question or not _last_documents: @@ -414,10 +433,6 @@ async def run_agent_streaming(user_input: str, session_id: str = "default", max_ yield "Sorry, I didn't receive any questions. Please enter your question or request." return - # Store the original user question for validation - from .tools import store_user_question - store_user_question(user_input.strip()) - retry_count = 0 last_error = None current_run_id = None @@ -545,13 +560,16 @@ async def run_agent_streaming(user_input: str, session_id: str = "default", max_ yield "Sorry, the system is currently busy. Please try again in a little while." return - except APIError as e: + except (APIError, httpx.RemoteProtocolError, httpx.ReadError, httpx.ConnectError) as e: retry_count += 1 last_error = e - logger.error(f"OpenAI API error: {str(e)}") + error_type = type(e).__name__ + logger.error(f"OpenAI API/Connection error ({error_type}): {str(e)}") if retry_count <= max_retries: - await asyncio.sleep(2) + wait_time = min(2 ** retry_count, 10) # Exponential backoff, max 10 seconds + logger.info(f"Retrying after {wait_time} seconds... (Attempt {retry_count}/{max_retries})") + await asyncio.sleep(wait_time) continue else: yield "Sorry, there was an error connecting to the service. Please try again later." diff --git a/core/context_enrichment.py b/core/context_enrichment.py index 4810f32bab704dcd18eaaeb01a7bbbf759426450..2b995a88a2c15700155b06d67b74c705deb524e5 100644 --- a/core/context_enrichment.py +++ b/core/context_enrichment.py @@ -25,6 +25,7 @@ class ContextEnricher: """ self._document_cache: Dict[str, List[Document]] = {} self._cache_size = cache_size + self._all_chunks_cache: Optional[List[Document]] = None # Cache all chunks to avoid reloading def enrich_documents( self, @@ -187,8 +188,13 @@ class ContextEnricher: try: from . import utils - # Load all chunks - all_chunks = utils.load_chunks() + # Load all chunks (use cached version to avoid redundant loading) + if self._all_chunks_cache is None: + self._all_chunks_cache = utils.load_chunks() + if self._all_chunks_cache: + logger.debug(f"Loaded {len(self._all_chunks_cache)} chunks into enricher cache") + + all_chunks = self._all_chunks_cache if not all_chunks: logger.debug(f"No chunks available for enrichment") return None diff --git a/core/github_storage.py b/core/github_storage.py index 9cb2aa0602575d9163c772027331232c9565d5b3..872cab175233e84a2aa53d32339f287a40c7e623 100644 --- a/core/github_storage.py +++ b/core/github_storage.py @@ -1,5 +1,5 @@ """ -GitHub Storage Utility for Medical RAG Advisor +GitHub Storage Utility for Lung Cancer AI Advisor Handles saving side effects reports and validation results to GitHub repository """ import os @@ -7,6 +7,8 @@ import json import csv import io import base64 +import time +import traceback from datetime import datetime from typing import Dict, List, Any, Optional import requests @@ -28,7 +30,14 @@ class GitHubStorage: github_token: GitHub personal access token """ self.repo_url = repo_url - self.github_token = github_token or os.getenv("GITHUB_TOKEN", "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") + self.github_token = github_token or os.getenv("GITHUB_TOKEN") + + # Log token status (masked for security) + if self.github_token: + token_preview = self.github_token[:7] + "..." + self.github_token[-4:] if len(self.github_token) > 11 else "***" + logger.info(f"GitHub token configured: {token_preview}") + else: + logger.warning("No GitHub token configured - uploads will fail!") # Extract owner and repo name from URL if "github.com/" in repo_url: @@ -100,19 +109,44 @@ class GitHubStorage: if sha: data["sha"] = sha - # Make API request + # Make API request with timeout url = f"{self.api_base}/contents/{file_path}" - response = requests.put(url, headers=self.headers, json=data) + logger.info(f"Uploading to GitHub: {file_path} (size: {len(content)} bytes)") + response = requests.put(url, headers=self.headers, json=data, timeout=30) if response.status_code in [200, 201]: - logger.info(f"Successfully uploaded {file_path} to GitHub") + logger.info(f"✓ Successfully uploaded {file_path} to GitHub") return True + elif response.status_code == 401: + logger.error(f"❌ Authentication failed uploading {file_path}: Invalid or expired GitHub token") + logger.error(f"Response: {response.text}") + return False + elif response.status_code == 403: + logger.error(f"❌ Permission denied uploading {file_path}: Token lacks required permissions") + logger.error(f"Response: {response.text}") + return False + elif response.status_code == 404: + logger.error(f"❌ Repository not found: {self.owner}/{self.repo_name}") + logger.error(f"Response: {response.text}") + return False + elif response.status_code == 409: + logger.error(f"Conflict error uploading {file_path}: File may have been modified. Status: {response.status_code}") + logger.error(f"Response: {response.text[:500]}") + return False else: - logger.error(f"Failed to upload {file_path}: {response.status_code} - {response.text}") + logger.error(f"Failed to upload {file_path}. Status: {response.status_code}") + logger.error(f"Response: {response.text}") return False + except requests.exceptions.Timeout as e: + logger.error(f"Timeout uploading file to GitHub: {e}") + return False + except requests.exceptions.RequestException as e: + logger.error(f"Request exception uploading file to GitHub: {e}") + return False except Exception as e: - logger.error(f"Exception uploading file to GitHub: {e}") + logger.error(f"Unexpected exception uploading file to GitHub: {e}") + logger.error(f"Traceback: {traceback.format_exc()}") return False def _get_file_content(self, file_path: str) -> Optional[str]: @@ -201,7 +235,8 @@ class GitHubStorage: def save_validation_results(self, evaluation_data: Dict[str, Any]) -> bool: """ - Save validation results to GitHub repository as JSON + Save validation results to GitHub repository as JSON with robust append logic. + Always loads existing data first, then appends new evaluation without overwriting. Args: evaluation_data: Dictionary containing evaluation data with interaction_id already set @@ -209,50 +244,99 @@ class GitHubStorage: Returns: True if successful, False otherwise """ - try: - file_path = "medical_data/evaluation_results.json" - - # Get existing file content - existing_content = self._get_file_content(file_path) - - # Parse existing data or create new list - if existing_content: - try: - evaluations = json.loads(existing_content) - if not isinstance(evaluations, list): - evaluations = [] - except json.JSONDecodeError: - logger.warning("Failed to parse existing evaluation_results.json, starting fresh") - evaluations = [] - else: + max_retries = 3 + retry_count = 0 + + while retry_count < max_retries: + try: + file_path = "medical_data/evaluation_results.json" + + # STEP 1: Get existing file content with verification + logger.info(f"Attempt {retry_count + 1}/{max_retries}: Loading existing evaluations from GitHub...") + existing_content = self._get_file_content(file_path) + + # STEP 2: Parse existing data or create new list evaluations = [] - - # Log the current state - logger.info(f"Loading existing evaluations: {len(evaluations)} found") - logger.info(f"Adding new evaluation with ID: {evaluation_data.get('interaction_id', 'unknown')}") - - # Add new evaluation to the list - evaluations.append(evaluation_data) - - # Convert to JSON string - json_content = json.dumps(evaluations, indent=2, ensure_ascii=False) - - # Get SHA for update - sha = self._get_file_sha(file_path) - - # Upload file - commit_message = f"Add validation results for interaction {evaluation_data.get('interaction_id', 'unknown')} - {evaluation_data.get('timestamp', 'unknown time')}" - - success = self._upload_file(file_path, json_content, commit_message, sha) - - if success: - logger.info(f"Successfully saved evaluation. Total evaluations now: {len(evaluations)}") - - return success - - except Exception as e: - logger.error(f"Error saving validation results to GitHub: {e}") - return False + if existing_content: + try: + evaluations = json.loads(existing_content) + if not isinstance(evaluations, list): + logger.warning("Existing content is not a list, creating new list") + evaluations = [] + else: + logger.info(f"Successfully loaded {len(evaluations)} existing evaluations") + except json.JSONDecodeError as e: + logger.error(f"Failed to parse existing evaluation_results.json: {e}") + # Don't start fresh - this could lose data. Instead, fail and retry. + if retry_count < max_retries - 1: + retry_count += 1 + logger.warning(f"Retrying due to JSON parse error...") + time.sleep(2) # Wait before retry + continue + else: + logger.error("Max retries reached. Cannot parse existing data.") + return False + else: + logger.info("No existing file found, creating new evaluation list") + + # STEP 3: Verify we're not about to lose data + new_interaction_id = evaluation_data.get('interaction_id', 'unknown') + logger.info(f"Adding new evaluation with ID: {new_interaction_id}") + + # Check if this ID already exists (prevent duplicates) + existing_ids = [e.get('interaction_id') for e in evaluations] + if new_interaction_id in existing_ids: + logger.warning(f"Evaluation with ID {new_interaction_id} already exists. Skipping duplicate.") + return True # Not an error, just already saved + + # STEP 4: Add new evaluation to the list (APPEND, not replace) + evaluations.append(evaluation_data) + logger.info(f"Appended new evaluation. Total count: {len(evaluations)}") + + # STEP 5: Convert to JSON string + json_content = json.dumps(evaluations, indent=2, ensure_ascii=False) + + # STEP 6: Get SHA for update (must be fresh to avoid conflicts) + sha = self._get_file_sha(file_path) + if existing_content and not sha: + logger.error("File exists but SHA not found. Possible race condition.") + if retry_count < max_retries - 1: + retry_count += 1 + logger.warning("Retrying due to SHA retrieval failure...") + time.sleep(2) # Wait before retry + continue + else: + return False + + # STEP 7: Upload file with the complete list + commit_message = f"Add validation results for interaction {new_interaction_id} - {evaluation_data.get('timestamp', 'unknown time')}" + + success = self._upload_file(file_path, json_content, commit_message, sha) + + if success: + logger.info(f"✓ Successfully saved evaluation {new_interaction_id}. Total evaluations now: {len(evaluations)}") + return True + else: + logger.error(f"Failed to upload file (attempt {retry_count + 1}/{max_retries})") + if retry_count < max_retries - 1: + retry_count += 1 + logger.warning("Retrying upload...") + time.sleep(2) # Wait before retry + continue + else: + return False + + except Exception as e: + logger.error(f"Error saving validation results to GitHub (attempt {retry_count + 1}/{max_retries}): {e}") + if retry_count < max_retries - 1: + retry_count += 1 + logger.warning("Retrying due to exception...") + time.sleep(2) # Wait before retry + continue + else: + return False + + return False def get_side_effects_reports(self) -> List[Dict[str, Any]]: """ diff --git a/core/retrievers.py b/core/retrievers.py index beaac15544958a5def47e397e6610348f162a899..ea116166a3f3959c516a3209a4ee279b26afd8b0 100644 --- a/core/retrievers.py +++ b/core/retrievers.py @@ -11,7 +11,7 @@ from .query_expansion import expand_medical_query, MultiQueryRetriever # Global configuration for retrieval parameters # Increased for more comprehensive context and complete answers -DEFAULT_K_VECTOR = 10 # Number of documents to retrieve from vector search +DEFAULT_K_VECTOR = 10 # Number of documents to retrieve from vector search DEFAULT_K_BM25 = 5 # Number of documents to retrieve from BM25 search # Global variables for lazy loading @@ -122,7 +122,7 @@ def _match_provider(doc, provider: str) -> bool: @traceable(name="VectorRetriever") -def vector_search(query: str, provider: str | None = None, k: int = None, use_query_expansion: bool = True): +def vector_search(query: str, provider: str | None = None, k: int = None, use_query_expansion: bool = False): """Search FAISS vector store with optional provider metadata filter and query expansion.""" _ensure_initialized() if not _vector_store: @@ -173,7 +173,7 @@ def vector_search(query: str, provider: str | None = None, k: int = None, use_qu @traceable(name="BM25Retriever") -def bm25_search(query: str, provider: str | None = None, k: int = None, use_query_expansion: bool = True): +def bm25_search(query: str, provider: str | None = None, k: int = None, use_query_expansion: bool = False): """Search BM25 using the global retriever with query expansion and optional provider filter.""" _ensure_initialized() @@ -196,7 +196,7 @@ def bm25_search(query: str, provider: str | None = None, k: int = None, use_quer for var_query in query_variations: _bm25_retriever.k = max(1, k * 2) - docs = _bm25_retriever.get_relevant_documents(var_query) or [] + docs = _bm25_retriever.invoke(var_query) or [] # Deduplicate while preserving order for doc in docs: @@ -209,7 +209,7 @@ def bm25_search(query: str, provider: str | None = None, k: int = None, use_quer else: # Standard search without expansion _bm25_retriever.k = max(1, k) - docs = _bm25_retriever.get_relevant_documents(query) or [] + docs = _bm25_retriever.invoke(query) or [] if provider: docs = [d for d in docs if _match_provider(d, provider)] @@ -219,7 +219,7 @@ def bm25_search(query: str, provider: str | None = None, k: int = None, use_quer return [] -def hybrid_search(query: str, provider: str | None = None, k_vector: int = None, k_bm25: int = None, use_query_expansion: bool = True): +def hybrid_search(query: str, provider: str | None = None, k_vector: int = None, k_bm25: int = None, use_query_expansion: bool = False): """Combine vector and BM25 results with query expansion (provider-filtered if provided).""" _ensure_initialized() # Ensure retrievers are initialized before parallel execution diff --git a/core/tools.py b/core/tools.py index ea15e951f348e3502121ebfeabacc5bf26993480..8a2a9ececc21c03d93b31020451472b5756651d5 100644 --- a/core/tools.py +++ b/core/tools.py @@ -8,60 +8,33 @@ from typing import Optional, List import pytz from langchain.schema import Document, HumanMessage, SystemMessage from langchain.tools import tool -from .retrievers import hybrid_search, vector_search, bm25_search +from .retrievers import hybrid_search from .validation import validate_medical_answer from .github_storage import get_github_storage from .context_enrichment import enrich_retrieved_documents from .config import logger from langchain_openai import ChatOpenAI -CANONICAL_PROVIDERS = {"Manus", "ASCO", "NCCN", "ESMO", "NICE"} +# Canonical provider names - used for "all providers" queries +CANONICAL_PROVIDERS = ["NCCN", "ASCO", "ESMO", "NICE", "Manus"] + +# Global configuration for medical_guidelines_knowledge_tool retrieval and enrichment +# These control the number of documents retrieved and context pages added +# When no provider is specified, these settings are applied PER PROVIDER (5 providers total) +# When a specific provider is given, these settings apply to that single provider +TOOL_K_VECTOR = 5 # Number of documents to retrieve using vector search (per provider) +TOOL_K_BM25 = 1 # Number of documents to retrieve using BM25 search (per provider) +TOOL_PAGES_BEFORE = 1 # Number of pages to include before each top result +TOOL_PAGES_AFTER = 1 # Number of pages to include after each top result +TOOL_MAX_ENRICHED = 1 # Maximum number of top documents to enrich with context (per provider) # Global variables to store context for validation _last_question = None # Stores the tool query -_last_user_question = None # Stores the original user question _last_documents = None -_last_answer = None TOOL_MAX_WORKERS = max(2, min(8, (os.cpu_count() or 4))) _tool_executor = ThreadPoolExecutor(max_workers=TOOL_MAX_WORKERS) -def store_user_question(user_question: str): - """Store the original user question for validation purposes.""" - global _last_user_question - _last_user_question = user_question - -def _get_llm_safe(temperature: float = 0.0, model: str = "gpt-4o"): - """Create a ChatOpenAI client if API key/config is available, else return None.""" - try: - # ChatOpenAI will read OPENAI_API_KEY from env as in validation.py - return ChatOpenAI(model=model, temperature=temperature, max_tokens=512, request_timeout=30) - except Exception: - return None - -def _is_side_effect_report_llm(user_input: str) -> Optional[bool]: - """Use LLM to classify if input is an adverse drug reaction/side-effect report. - Returns True/False if confident, or None if unavailable/uncertain. - """ - llm = _get_llm_safe() - if not llm: - return None - try: - system = SystemMessage(content=( - "You are a medical triage classifier. Decide if the user's text is a report of an adverse drug reaction (side effect) about a medication.\n" - "Criteria: mentions a medication/drug and symptoms or adverse effects experienced by a patient.\n" - "Respond with exactly one token: yes or no." - )) - human = HumanMessage(content=user_input[:1500]) - resp = llm.invoke([system, human]) - ans = (resp.content or "").strip().lower() - if ans.startswith("yes"): - return True - if ans.startswith("no"): - return False - return None - except Exception: - return None # Map lowercase variants and full names to canonical provider codes _PROVIDER_ALIASES = { @@ -87,47 +60,60 @@ _PROVIDER_ALIASES = { } -def _normalize_provider_from_text(text: str) -> Optional[str]: +def _normalize_provider(provider: Optional[str], query: str) -> Optional[str]: + """Normalize provider name from explicit parameter or query text. + + Handles: + - Exact canonical matches (e.g., "NCCN", "nccn") + - Full name aliases (e.g., "National Comprehensive Cancer Network") + - Provider mentions in text (e.g., "according to NCCN guidelines") + + Args: + provider: Explicit provider name if specified + query: Query text that may contain provider reference + + Returns: + Canonical provider name (NCCN, ASCO, ESMO, NICE, Manus) or None + """ + # Try explicit provider first, then fall back to query text + text = provider if provider else query if not text: return None + t = text.lower() + # Quick direct hits for canonical providers for canon in CANONICAL_PROVIDERS: if re.search(rf"\b{re.escape(canon.lower())}\b", t): return canon + # Alias-based detection for alias, canon in _PROVIDER_ALIASES.items(): if alias in t: return canon + + # If explicit provider didn't match, try query text as fallback + if provider and provider != query: + return _normalize_provider(None, query) + return None -def _normalize_provider(provider: Optional[str], query: str) -> Optional[str]: - # If explicit provider given, normalize it first - if provider: - p = provider.strip().lower() - # Exact canonical match - for canon in CANONICAL_PROVIDERS: - if p == canon.lower(): - return canon - # Alias match - if p in _PROVIDER_ALIASES: - return _PROVIDER_ALIASES[p] - # Try to find within text like "according to NCCN guidelines" - norm = _normalize_provider_from_text(provider) - if norm: - return norm - # Fall back to inferring from query text - return _normalize_provider_from_text(query) - - -def clear_text(text: str, max_chars: int = 1200) -> str: - """Reduce token bloat by removing heavy markdown and collapsing whitespace. +def clear_text(text: str) -> str: + """Clean and normalize text by removing markdown and excess whitespace. + + Operations: - Convert [title](url) -> title (url) - Remove images ![alt](url) - - Strip code fences/backticks and most markdown emphasis - - Collapse multiple newlines/spaces - - Trim to max_chars + - Strip code fences, backticks, and markdown emphasis + - Collapse multiple newlines and spaces + - Trim whitespace + + Args: + text: Raw text to clean + + Returns: + Cleaned text string """ if not text: return "" @@ -150,37 +136,147 @@ def clear_text(text: str, max_chars: int = 1200) -> str: t = re.sub(r"[ \t]{2,}", " ", t) # Trim and truncate t = t.strip() - if max_chars and len(t) > max_chars: - t = t[:max_chars].rstrip() + " ..." return t -def _format_docs_with_citations(docs: List[Document]) -> str: +def _format_docs_with_citations(docs: List[Document], group_by_provider: bool = False) -> str: + """Format documents with citations. + + Args: + docs: List of documents to format + group_by_provider: If True, group results by provider with headers + + Returns: + Formatted string with document citations + """ if not docs: return "No results." + if group_by_provider: + return _format_grouped_by_provider(docs) + parts = [] for i, d in enumerate(docs, start=1): meta = d.metadata or {} - source = meta.get("source", "unknown") - page = meta.get("page_number", "?") - provider = meta.get("provider", "unknown") - disease = meta.get("disease", "unknown") - is_context = meta.get("context_enrichment", False) + citation = _build_citation(i, meta, d.page_content) + parts.append(citation) + + return "\n\n".join(parts) + + +def _build_citation(index: int, metadata: dict, content: str, include_provider: bool = True) -> str: + """Build a single citation string with clean formatting. + + Args: + index: Result number + metadata: Document metadata + content: Document content + include_provider: Whether to include provider in metadata line + + Returns: + Formatted citation string + """ + source = metadata.get("source", "unknown") + page = metadata.get("page_number", "?") + provider = metadata.get("provider", "unknown") + disease = metadata.get("disease", "unknown") + is_context = metadata.get("context_enrichment", False) + + snippet = clear_text(content) + + # Build citation header + citation = f"📄 Result {index}:\n" + + # Build metadata line + metadata_parts = [] + if include_provider: + metadata_parts.append(f"Provider: {provider}") + metadata_parts.append(f"Disease: {disease}") + metadata_parts.append(f"Source: {source}") + metadata_parts.append(f"Page: {page}") + + citation += " | ".join(metadata_parts) + + if is_context: + citation += " [CONTEXT PAGE]" + + citation += f"\n\n{snippet}\n" + return citation + + +def _document_to_dict(doc: Document) -> dict: + """Convert a Document to a dictionary for storage. + + Args: + doc: Document to convert - snippet = clear_text(d.page_content) + Returns: + Dictionary with document metadata and content + """ + return { + "doc_id": getattr(doc, 'id', None), + "source": doc.metadata.get("source", "unknown"), + "provider": doc.metadata.get("provider", "unknown"), + "page_number": doc.metadata.get("page_number", "unknown"), + "disease": doc.metadata.get("disease", "unknown"), + "context_enrichment": doc.metadata.get("context_enrichment", False), + "enriched": doc.metadata.get("enriched", False), + "pages_included": doc.metadata.get("pages_included", []), + "primary_page": doc.metadata.get("primary_page"), + "context_pages_before": doc.metadata.get("context_pages_before"), + "context_pages_after": doc.metadata.get("context_pages_after"), + "content": doc.page_content + } + + +def _format_grouped_by_provider(docs: List[Document]) -> str: + """Format results grouped by provider for multi-provider queries. + + Args: + docs: List of documents to format - # Build citation header - citation = f"Result {i}:\n" - citation += f"Provider: {provider} | Disease: {disease} | Source: {source} | Page: {page}" + Returns: + Formatted string with documents grouped by provider + """ + if not docs: + return "No results found from any guideline provider." + + # Group documents by provider + provider_groups = {} + for doc in docs: + provider = doc.metadata.get("provider", "unknown") + if provider not in provider_groups: + provider_groups[provider] = [] + provider_groups[provider].append(doc) + + # Format header + parts = [ + f"\n{'='*70}", + f"MULTI-PROVIDER SEARCH RESULTS", + f"Retrieved information from {len(provider_groups)} guideline provider(s)", + f"{'='*70}\n" + ] + + # Format each provider's results + for idx, provider in enumerate(sorted(provider_groups.keys()), start=1): + provider_docs = provider_groups[provider] - # Add context enrichment marker if this is a context page - if is_context: - citation += " [CONTEXT PAGE]" + # Provider header + parts.append(f"\n{'─'*70}") + parts.append(f"🏥 PROVIDER {idx}: {provider} ({len(provider_docs)} result{'s' if len(provider_docs) != 1 else ''})") + parts.append(f"{'─'*70}\n") - citation += f"\nText:\n{snippet}\n" - parts.append(citation) + # Format each document for this provider + for i, doc in enumerate(provider_docs, start=1): + meta = doc.metadata or {} + # Use _build_citation but without provider in metadata (already in header) + citation = _build_citation(i, meta, doc.page_content, include_provider=False) + parts.append(citation) + + # Add separator between results (except after last one) + if i < len(provider_docs): + parts.append("") - return "\n\n".join(parts) + return "\n".join(parts) @tool @@ -188,7 +284,14 @@ def medical_guidelines_knowledge_tool(query: str, provider: Optional[str] = None """ Retrieve comprehensive medical guideline knowledge with enriched context. Includes surrounding pages (before/after) for top results to provide complete clinical context. - If provider is provided (e.g., "NCCN", "ASCO", "ESMO", "NICE"), results will be filtered by metadata provider. + + Behavior: + - If provider is specified (e.g., "NCCN", "ASCO", "ESMO", "NICE"): queries only that provider + - If provider is NOT specified: queries ALL providers separately and combines results for balanced representation + + This ensures that results include perspectives from all guideline providers, preventing any single + provider from dominating the results due to higher similarity scores. + Returns detailed text with full metadata and contextual information for expert analysis. """ global _last_question, _last_documents @@ -199,42 +302,61 @@ def medical_guidelines_knowledge_tool(query: str, provider: Optional[str] = None # Normalize provider name from either explicit arg or query text normalized_provider = _normalize_provider(provider, query) - # Use hybrid search with query expansion for comprehensive retrieval - # Uses global defaults: DEFAULT_K_VECTOR=10, DEFAULT_K_BM25=5 (configurable in core/retrievers.py) - docs = hybrid_search(query=query, provider=normalized_provider) + # If no specific provider is given, query ALL providers separately to ensure balanced representation + # This prevents one provider from dominating results due to higher similarity scores + if not normalized_provider: + logger.info("No specific provider - querying each provider separately for balanced results") + all_enriched_docs = [] + + for prov in CANONICAL_PROVIDERS: + try: + logger.info(f"Querying provider: {prov}") + docs = hybrid_search(query=query, provider=prov, k_vector=TOOL_K_VECTOR, k_bm25=TOOL_K_BM25, use_query_expansion=False) + + if docs: + # Enrich documents for this provider + enriched = enrich_retrieved_documents( + documents=docs, + pages_before=TOOL_PAGES_BEFORE, + pages_after=TOOL_PAGES_AFTER, + max_enriched=TOOL_MAX_ENRICHED + ) + all_enriched_docs.extend(enriched) + logger.info(f"Retrieved {len(docs)} documents from {prov}") + except Exception as e: + logger.warning(f"Error querying {prov}: {str(e)}") + # Continue with other providers even if one fails + continue + + if not all_enriched_docs: + return "No results found from any guideline provider for this query." + + # Store all documents for validation + _last_documents = [_document_to_dict(doc) for doc in all_enriched_docs] + + # Format results grouped by provider for better readability + return _format_docs_with_citations(all_enriched_docs, group_by_provider=True) + + # Single specific provider query + logger.info(f"Querying specific provider: {normalized_provider}") + docs = hybrid_search(query=query, provider=normalized_provider, + k_vector=TOOL_K_VECTOR, k_bm25=TOOL_K_BM25, + use_query_expansion=False) # Enrich top documents with surrounding pages for richer context - # This provides complete clinical context including adjacent information - # Increased pages_before/after and max_enriched for more comprehensive answers enriched_docs = enrich_retrieved_documents( documents=docs, - pages_before=2, # Include 2 pages before for fuller context - pages_after=2, # Include 2 pages after for fuller context - max_enriched=8 # Enrich top 8 most relevant documents + pages_before=TOOL_PAGES_BEFORE, + pages_after=TOOL_PAGES_AFTER, + max_enriched=TOOL_MAX_ENRICHED ) # Count context pages added context_pages_count = sum(1 for doc in enriched_docs if doc.metadata.get("context_enrichment", False)) logger.info(f"Retrieved {len(docs)} documents, added {context_pages_count} context pages") - # Store documents for validation context with enrichment metadata - _last_documents = [] - for doc in enriched_docs: - doc_dict = { - "doc_id": getattr(doc, 'id', None), - "source": doc.metadata.get("source", "unknown"), - "provider": doc.metadata.get("provider", "unknown"), - "page_number": doc.metadata.get("page_number", "unknown"), - "disease": doc.metadata.get("disease", "unknown"), - "context_enrichment": doc.metadata.get("context_enrichment", False), - "enriched": doc.metadata.get("enriched", False), - "pages_included": doc.metadata.get("pages_included", []), - "primary_page": doc.metadata.get("primary_page"), - "context_pages_before": doc.metadata.get("context_pages_before"), - "context_pages_after": doc.metadata.get("context_pages_after"), - "content": doc.page_content - } - _last_documents.append(doc_dict) + # Store documents for validation context + _last_documents = [_document_to_dict(doc) for doc in enriched_docs] return _format_docs_with_citations(enriched_docs) except Exception as e: @@ -242,6 +364,7 @@ def medical_guidelines_knowledge_tool(query: str, provider: Optional[str] = None return f"Retrieval error: {str(e)}" + @tool def compare_providers_tool(query: str, provider_a: str, provider_b: str) -> str: """ @@ -338,6 +461,52 @@ def get_current_datetime_tool() -> str: return f"Error getting current datetime: {str(e)}" +def _get_llm_safe(temperature: float = 0.0, model: str = "gpt-4o") -> Optional[ChatOpenAI]: + """Create a ChatOpenAI client if API key is available. + + Args: + temperature: Model temperature (0.0 = deterministic) + model: OpenAI model name + + Returns: + ChatOpenAI instance or None if unavailable + """ + try: + # ChatOpenAI will read OPENAI_API_KEY from env as in validation.py + return ChatOpenAI(model=model, temperature=temperature, max_tokens=512, request_timeout=30) + except Exception: + return None + +def _is_side_effect_report_llm(user_input: str) -> Optional[bool]: + """Classify if input is an adverse drug reaction report using LLM. + + Args: + user_input: User's text input + + Returns: + True if side effect report, False if not, None if uncertain/unavailable + """ + llm = _get_llm_safe() + if not llm: + return None + try: + system = SystemMessage(content=( + "You are a medical triage classifier. Decide if the user's text is a report of an adverse drug reaction (side effect) about a medication.\n" + "Criteria: mentions a medication/drug and symptoms or adverse effects experienced by a patient.\n" + "Respond with exactly one token: yes or no." + )) + human = HumanMessage(content=user_input[:1500]) + resp = llm.invoke([system, human]) + ans = (resp.content or "").strip().lower() + if ans.startswith("yes"): + return True + if ans.startswith("no"): + return False + return None + except Exception: + return None + + @tool def side_effect_recording_tool(user_input: str) -> str: """ @@ -520,9 +689,6 @@ def _identify_missing_optional_information(extracted_data: dict) -> list: return missing -# Remove this function as we no longer ask for optional information - - def _generate_information_request(extracted_data: dict, missing_info: list) -> str: """Generate a medical-professional request for missing critical information.""" @@ -853,17 +1019,7 @@ def _extract_with_improved_regex(user_input: str) -> dict: return extracted -def _extract_side_effect_data(user_input: str) -> dict: - """ - Extract structured data from side effect report text. - - Args: - user_input (str): Raw input text containing side effect report - - Returns: - dict: Structured data extracted from the input - """ - # Use the new LLM-based extraction - return _extract_side_effect_data_with_llm(user_input) +# Alias for backward compatibility +_extract_side_effect_data = _extract_side_effect_data_with_llm diff --git a/core/validation.py b/core/validation.py index 84da513b3fcd7cb61aeea095f1cff159f04d41b2..7c88746cc1b380c7e79ecd214de6a6b5a15ab775 100644 --- a/core/validation.py +++ b/core/validation.py @@ -1,6 +1,7 @@ import json import os import uuid +import traceback from datetime import datetime from typing import Dict, List, Any, Optional import pytz @@ -513,20 +514,26 @@ Documents: {formatted_docs}""" def _save_evaluation(self, evaluation: Dict[str, Any]) -> None: """Save evaluation to GitHub repository.""" try: + logger.info(f"Attempting to save evaluation with ID: {evaluation['interaction_id']}") + # Try to save to GitHub first github_storage = get_github_storage() + logger.info("GitHub storage instance obtained, calling save_validation_results...") success = github_storage.save_validation_results(evaluation) if success: - logger.info(f"Evaluation saved to GitHub with ID: {evaluation['interaction_id']}") + logger.info(f"✓ Evaluation saved to GitHub successfully with ID: {evaluation['interaction_id']}") else: + logger.warning(f"GitHub save failed for evaluation {evaluation['interaction_id']}, falling back to local storage") # Fallback to local storage if GitHub fails evaluations = [] if os.path.exists(self.evaluation_file): try: with open(self.evaluation_file, 'r', encoding='utf-8') as f: evaluations = json.load(f) - except (json.JSONDecodeError, FileNotFoundError): + logger.info(f"Loaded {len(evaluations)} existing evaluations from local file") + except (json.JSONDecodeError, FileNotFoundError) as e: + logger.warning(f"Could not load local file: {e}") evaluations = [] # Add new evaluation @@ -536,10 +543,11 @@ Documents: {formatted_docs}""" with open(self.evaluation_file, 'w', encoding='utf-8') as f: json.dump(evaluations, f, indent=2, ensure_ascii=False) - logger.info(f"Evaluation saved locally (GitHub failed) with ID: {evaluation['interaction_id']}") + logger.info(f"✓ Evaluation saved locally (GitHub failed) with ID: {evaluation['interaction_id']}") except Exception as e: logger.error(f"Failed to save evaluation: {e}") + logger.error(f"Traceback: {traceback.format_exc()}") def get_evaluation_summary(self, limit: int = 10) -> Dict[str, Any]: """Get summary of recent evaluations from GitHub repository.""" diff --git a/core/vector_store.py b/core/vector_store.py index 2b67a02d215928dd2db1724c76355ad5fdf7670e..c431a06fdbd8e42c1591881374dcf68c1b81a24e 100644 --- a/core/vector_store.py +++ b/core/vector_store.py @@ -1,14 +1,30 @@ +from typing import Optional +from pathlib import Path +from langchain.vectorstores import FAISS +from langchain.embeddings import HuggingFaceEmbeddings + from . import utils -from .config import logger +from .config import logger, VECTOR_STORE_DIR, EMBEDDING_MODEL + +# Global instance +_vector_store_instance = None + +def get_vector_store() -> Optional[FAISS]: + """Get the current vector store instance""" + global _vector_store_instance + return _vector_store_instance def create_vector_store(): - + """Create a new vector store instance""" + global _vector_store_instance + # Try to load existing vector store, create if not found try: company_documents = utils.create_company_documents() company_chunks = utils.split_documents(company_documents) - vector_store = utils.create_company_vector_store(company_chunks) + _vector_store_instance = utils.create_company_vector_store(company_chunks) logger.info("Vector store created successfully") + return _vector_store_instance except Exception as e: logger.error(f"Error creating vector store: {str(e)}") raise @@ -16,20 +32,20 @@ def create_vector_store(): def load_vector_store() -> Optional[FAISS]: """Load existing vector store with proper error handling""" + global _vector_store_instance try: if Path(VECTOR_STORE_DIR).exists(): - vector_store = FAISS.load_local( + _vector_store_instance = FAISS.load_local( str(VECTOR_STORE_DIR), EMBEDDING_MODEL, allow_dangerous_deserialization=True ) logger.info("Successfully loaded existing vector store") - return vector_store + return _vector_store_instance else: logger.info("No existing vector store found") logger.info("Creating new vector store...") - create_vector_store() - return None + return create_vector_store() except Exception as e: logger.error(f"Failed to load vector store: {e}") return None diff --git a/data/medical_terms_cache.json b/data/medical_terms_cache.json index da967771fbfb0ae4ee111e01fd415f65598cfa16..20da7a119eed9bdfacf7cbb2581d73065acb79e4 100644 --- a/data/medical_terms_cache.json +++ b/data/medical_terms_cache.json @@ -4,22 +4,22 @@ "esmo" ], "esmo": [ - "european\nsociety of medical oncology", - "the european society for medical oncology", "the european society for medical\noncology", - "european society for medical oncology", + "european society of medical oncology", + "the european society for medical oncology", "european society for\nmedical oncology", - "european society of medical oncology" + "european society for medical oncology", + "european\nsociety of medical oncology" ], "american society of clinical\n\noncology": [ "asco" ], "asco": [ - "inc", - "american\nsociety of clinical oncology", "american society of clinical\n\noncology", + "inc", "md american society of clinical oncology", - "american society of clinical oncology" + "american society of clinical oncology", + "american\nsociety of clinical oncology" ], "italian association of medical oncology": [ "aiom" @@ -33,26 +33,26 @@ ], "nccn": [ "vs insurance-based", - "leading american cancer centers", - "national comprehensive cancer network" + "national comprehensive cancer network", + "leading american cancer centers" ], "non-small cell lung cancer": [ "nsclc" ], "nsclc": [ - "non-small-cell lung cancer", - "advanced non-small cell lung cancer", - "cancer", - "mutant advanced non-small cell lung cancer", - "stage iii non small cell lung cancer", + "non-small cell lung cancer", + "advanced non-small-cell lung cancer", + "small-cell lung cancer", "small cell\nlung cancer", "iii non-small-cell lung cancer", - "advanced non-small-cell lung cancer", + "mutant advanced non-small cell lung cancer", + "advanced non-small cell lung cancer", + "stage iii non small cell lung cancer", "small-cell\nlung cancer", + "cancer", "lung cancer", - "small-cell lung cancer", "robotic lobectomy for non-small cell lung cancer", - "non-small cell lung cancer" + "non-small-cell lung cancer" ], "american\nsociety of clinical oncology": [ "asco" @@ -77,9 +77,9 @@ "ema" ], "ema": [ - "and the european medicines\nagency", - "for all the newly\neuropean medicines agency", "european medicines agency", + "for all the newly\neuropean medicines agency", + "and the european medicines\nagency", "not european medicines agency" ], "evaluates treatments with curative intent": [ @@ -138,8 +138,8 @@ "rcts" ], "rcts": [ - "controlled trials", "clinical trials", + "controlled trials", "two randomized control trials" ], "the primary end point was disease-free\nsurvival": [ @@ -161,72 +161,72 @@ "inst" ], "inst": [ - "sutro biopharma", - "amgen", - "roche", - "merck", - "crispr\ntherapeutics", - "constellation pharmaceuticals", - "bristol-myers squibb", - "nuvation bio", - "calithera biosciences", - "genentech", - "gsk", - "astex pharmaceuticals", - "merck serono", - "vivace therapeutics", - "neogenomics", - "novartis", - "elevation oncology", - "advaxis", - "glaxosmithkline", - "bms", - "summit therapeutics", - "takeda", - "blueprint medicines", + "bayer", "pharmamar", - "astrazeneca canada", - "turning point therapeutics", - "janssen", - "glaxosmithkline canada", - "inc", - "abbvie", - "pfizer", - "polaris", - "exelixis", + "trizell", "macrogenics", - "bristol myers squibb foundation", + "blueprint medicines", "astrazeneca", - "oric pharmaceuticals", - "mirati therapeutics", - "puma biotechnology", - "palobiofarma", - "anheart therapeutics", - "harpoon therapeutics", + "vivace therapeutics", + "bristol myers squibb", + "astrazeneca canada", + "black diamond\ntherapeutics", "boehringer ingelheim", - "cullinan oncology", - "trizell", - "medimmune", - "arcus biosciences", + "anheart therapeutics", "lilly", - "therapeutics", - "oncomed", - "black diamond\ntherapeutics", - "janssen oncology", + "medimmune", + "bristol myers\nsquibb", + "exelixis", + "revolution medicines", "jazz pharmaceuticals", - "astra zeneca", + "pfizer", "dizal\npharma", - "msd", - "bristol myers squibb", + "bristol myers squibb foundation", "dohme", + "guardant health", + "oncomed", + "arcus biosciences", + "janssen", + "therapeutics", + "polaris", + "glaxosmithkline canada", + "calithera biosciences", + "nuvation bio", + "astex pharmaceuticals", + "advaxis", + "bristol-myers squibb", + "merck", + "summit therapeutics", + "turning point therapeutics", + "amgen", + "janssen oncology", + "palobiofarma", + "neogenomics", + "crispr\ntherapeutics", + "inc", "regeneron", + "forward", + "novartis", + "mirati therapeutics", + "sutro biopharma", + "constellation pharmaceuticals", + "merck serono", + "puma biotechnology", + "msd", + "oric pharmaceuticals", + "genentech", + "takeda", + "abbvie", "inhibrx", - "guardant health", + "glaxosmithkline", "verastem", - "bristol myers\nsquibb", - "revolution medicines", - "forward", - "bayer" + "harpoon therapeutics", + "astra zeneca", + "cullinan oncology", + "roche", + "gsk", + "bms", + "elevation oncology" ], "pfizer": [ "inst" @@ -254,10 +254,10 @@ "sclc" ], "sclc": [ - "and small-cell lung cancer", + "or small-cell lung cancer", "trial in small cell lung cancer", - "small cell lung cancer", - "or small-cell lung cancer" + "and small-cell lung cancer", + "small cell lung cancer" ], "cancer": [ "relay", @@ -276,8 +276,8 @@ "pci" ], "pci": [ - "dose prophylactic cranial irradiation", - "prophylactic cranial irradiation" + "prophylactic cranial irradiation", + "dose prophylactic cranial irradiation" ], "the bottom line": [ "continued" @@ -290,10 +290,10 @@ "sbrt" ], "sbrt": [ - "salvage stereotactic body radiation therapy", - "stereotactic body radiotherapy", "fdg-pet and stereotactic body radiotherapy", - "sabr or stereotactic body radiotherapy" + "sabr or stereotactic body radiotherapy", + "salvage stereotactic body radiation therapy", + "stereotactic body radiotherapy" ], "oncomed": [ "inst" @@ -321,8 +321,8 @@ ], "alk": [ "crizotinib-pretreated anaplastic lymphoma kinase", - "positive anaplastic lymphoma kinase", - "and anaplastic lymphoma kinase" + "and anaplastic lymphoma kinase", + "positive anaplastic lymphoma kinase" ], "immunohistochemistry": [ "ihc" @@ -332,12 +332,12 @@ "immunohistochemistry" ], "merck": [ - "inst", - "german" + "german", + "inst" ], "glaxosmithkline": [ - "inst", - "gsk" + "gsk", + "inst" ], "astex pharmaceuticals": [ "inst" @@ -346,8 +346,8 @@ "inst" ], "bristol myers\nsquibb": [ - "inst", - "bms" + "bms", + "inst" ], "polaris": [ "inst" @@ -408,8 +408,8 @@ "inst" ], "bms": [ - "bristol-myers\nsquibb", "bristol myers squibb", + "bristol-myers\nsquibb", "inst", "bristol myers\nsquibb", "bristol\nmyers squibb", @@ -431,30 +431,30 @@ "rct" ], "rct": [ + "phase iib\nrandomised controlled trial", "phase iii randomised clinical trial", "one randomized controlled trial", - "a phase iii randomised clinical trial", - "phase iib\nrandomised controlled trial" + "a phase iii randomised clinical trial" ], "the primary end point of progression-free survival": [ "pfs" ], "pfs": [ "no\nimprovement in progression-free survival", - "the median\nprogression-free survival", + "and\nprogression-free survival", "the median progression-free\nsurvival", - "the primary end point of progression-free survival", + "reported improved\nprogression-free survival", + "the median\nprogression-free survival", "quality of life and progression-free survival", - "and\nprogression-free survival", - "reported improved\nprogression-free survival" + "the primary end point of progression-free survival" ], "adverse events": [ "aes" ], "aes": [ + "mainly altered lipid levels", "adverse events", - "adverse\nevents", - "mainly altered lipid levels" + "adverse\nevents" ], "and consolidation": [ "for unresectable stage iii nsclc" @@ -494,8 +494,8 @@ "though rates of\nimmune-related aes" ], "bristol myers squibb": [ - "inst", - "bms" + "bms", + "inst" ], "palobiofarma": [ "inst" @@ -529,8 +529,8 @@ "inst" ], "gsk": [ - "glaxosmithkline", - "inst" + "inst", + "glaxosmithkline" ], "regeneron": [ "inst" @@ -587,15 +587,15 @@ "health research methods" ], "health research methods": [ - "va asco practice guideline staff", - "va asco practice guidelines staff" + "va asco practice guidelines staff", + "va asco practice guideline staff" ], "in tyrosine kinase inhibitor": [ "tki" ], "tki": [ - "tyrosine kinase inhibitor", - "in tyrosine kinase inhibitor" + "in tyrosine kinase inhibitor", + "tyrosine kinase inhibitor" ], "reuss et al\n\n\n\nrate": [ "orr" @@ -620,8 +620,8 @@ "dor" ], "dor": [ - "the median\nduration of response", - "with a median duration of\nresponse" + "with a median duration of\nresponse", + "the median\nduration of response" ], "the most common treatment-emergent adverse events": [ "teaes" @@ -711,8 +711,8 @@ "crs" ], "crs": [ - "cytokine release syndrome", - "the most\ncommon ae was cytokine release syndrome" + "the most\ncommon ae was cytokine release syndrome", + "cytokine release syndrome" ], "asco-ontario health": [ "cancer care ontario" @@ -736,13 +736,13 @@ "fda" ], "fda": [ - "and the united states food and drug administration", - "and the food and drug administration", - "entrectinib received food and\ndrug administration", - "the food and drug administration", "the us food and drug administration", + "food and drug administration", "or food and drug administration", - "food and drug administration" + "entrectinib received food and\ndrug administration", + "the food and drug administration", + "and the united states food and drug administration", + "and the food and drug administration" ], "cytokine release syndrome": [ "crs" @@ -763,8 +763,8 @@ "nets" ], "nets": [ - "tumors", - "has grouped lung and thymic neuroendocrine\ntumours" + "has grouped lung and thymic neuroendocrine\ntumours", + "tumors" ], "small cell lung cancer": [ "sclc" @@ -791,8 +791,8 @@ "seer" ], "seer": [ - "and end results", - "epidemiology and end results" + "epidemiology and end results", + "and end results" ], "s syndrome": [ "cus" @@ -834,8 +834,8 @@ "ssas" ], "ssas": [ - "medical options", - "-labelled somatostatin analogues" + "-labelled somatostatin analogues", + "medical options" ], "urinary-free cortisol": [ "ufc" @@ -880,12 +880,12 @@ "cht" ], "cht": [ - "the beneficial effects of adjuvant chemotherapy", - "platinum-based chemo\ntherapy", - "chemotherapy", "over platinum-based doublet\nchemotherapy", "mainly cytotoxic chemotherapy", - "the addition of the chemotherapy" + "chemotherapy", + "the beneficial effects of adjuvant chemotherapy", + "the addition of the chemotherapy", + "platinum-based chemo\ntherapy" ], "or systemic therapies": [ "with options\ndiscussed in these guidelines" @@ -912,8 +912,8 @@ "rfa" ], "rfa": [ - "palliative surgery\nor radiofrequency ablation", - "for these patients radiofrequency ablation" + "for these patients radiofrequency ablation", + "palliative surgery\nor radiofrequency ablation" ], "or cryoablation or endobronchial treatment": [ "ebt" @@ -1016,10 +1016,10 @@ ], "esmo-mcbs": [ "an esmo\nmagnitude of clinical benefit scale", + "esmomagnitude of clinical benefit scale", "esmo-magnitude of\nclinical benefit", - "esmo-magnitude of clinical benefit scale", "esmo-magnitude of clinical\nbenefit", - "esmomagnitude of clinical benefit scale", + "esmo-magnitude of clinical benefit scale", "esmo-magnitude of clinical benefit" ], "advanced carcinoids of the lung and thymus": [ @@ -1074,15 +1074,15 @@ "chuv" ], "chuv": [ - "centre hospitalier universitaire vaudois", - "centre hospitalier universitaire\nvaudois" + "centre hospitalier universitaire\nvaudois", + "centre hospitalier universitaire vaudois" ], "comparing low-dose computed tomography": [ "ldct" ], "ldct": [ - "low-dose ct", - "comparing low-dose computed tomography" + "comparing low-dose computed tomography", + "low-dose ct" ], "such as lepidic adenocarcinomas": [ "previously named bronchioloalveolar carcinoma" @@ -1106,11 +1106,11 @@ "who" ], "who": [ - "global statistics", - "vs universal", "global", + "the recent world health organization", "world health organization", - "the recent world health organization" + "global statistics", + "vs universal" ], "with its further sub-classification of": [ "surgically resected" @@ -1125,8 +1125,8 @@ "ais" ], "ais": [ - "the categories adenocarcinoma in situ", - "proposed\nthat ais be classified as tis" + "proposed\nthat ais be classified as tis", + "the categories adenocarcinoma in situ" ], "minimally invasive adenocarcinoma": [ "mia" @@ -1156,16 +1156,16 @@ "uicc" ], "uicc": [ + "union for international\ncancer control", "union for international cancer control", - "the union for\ninternational cancer control", - "union for international\ncancer control" + "the union for\ninternational cancer control" ], "node and metastasis": [ "tnm" ], "tnm": [ - "node and metastasis", - "tumourenodeemetastasis" + "tumourenodeemetastasis", + "node and metastasis" ], "proposed\nthat ais be classified as tis": [ "ais" @@ -1269,8 +1269,8 @@ "neo" ], "neo": [ - "immunotherapy is being studied in early nsclc as", "the\nimmune strategy in the", + "immunotherapy is being studied in early nsclc as", "- immunotherapy is being studied in early nsclc as" ], "cl\n\ntreatment of locally advanced stage": [ @@ -1317,8 +1317,8 @@ "thoracoscore" ], "thoracoscore": [ - "the thoracic surgery scoring system", - "the thoracic surgery scoring\nsystem" + "the thoracic surgery scoring\nsystem", + "the thoracic surgery scoring system" ], "stereotactic body radiotherapy": [ "sbrt" @@ -1407,8 +1407,8 @@ "sub-lobar" ], "sub-lobar": [ - "special articles\n\n\n\nfor which patients is limited", - "for which patients is limited" + "for which patients is limited", + "special articles\n\n\n\nfor which patients is limited" ], "especially those with ground-glass\nopacity": [ "ggo" @@ -1515,17 +1515,17 @@ "primary endpoint" ], "primary endpoint": [ - "-year os", "pbc\nsignificantly improved pfs", "significantly improved os", + "-year os", "level" ], "besides immune checkpoint\n\ninhibitor": [ "ici" ], "ici": [ - "besides immune checkpoint\n\ninhibitor", - "and have no prior immune checkpoint inhibitor" + "and have no prior immune checkpoint inhibitor", + "besides immune checkpoint\n\ninhibitor" ], "esmo-magnitude of clinical benefit scale": [ "mcbs", @@ -1582,8 +1582,8 @@ ], "esmo scientific affairs staff": [ "nicola latino and\nfrancesca chiovaro", - "nicola\nlatino", "nicola\nlatino and francesca chiovaro", + "nicola\nlatino", "nicola latino" ], "bristol\nmyers squibb": [ @@ -1621,8 +1621,8 @@ ], "ngs": [ "multiplex platforms", - "such as next-generation sequencing", - "by next-generation sequencing" + "by next-generation sequencing", + "such as next-generation sequencing" ], "egfr fish or immunohistochemistry": [ "ihc" @@ -1634,8 +1634,8 @@ "ntrk" ], "ntrk": [ - "or neurotrophic tyrosine\nreceptor kinase", - "and the neurotrophic receptor tyrosine\nkinase" + "and the neurotrophic receptor tyrosine\nkinase", + "or neurotrophic tyrosine\nreceptor kinase" ], "detection is reliable by\nin situ hybridisation": [ "ish" @@ -1707,8 +1707,8 @@ ], "mos": [ "malaysia", - "and median os", - "the malaysian oncological society" + "the malaysian oncological society", + "and median os" ], "systemic progression\n\nlocal treatment": [ "surgery or ft" @@ -1732,8 +1732,8 @@ "single-agent" ], "ensartinib": [ - "not ema\napproved", - "not ema approved" + "not ema approved", + "not ema\napproved" ], "not ema\napproved": [ "ensartinib" @@ -1860,8 +1860,8 @@ "esmo scientific affairs staff" ], "and dr svetlana jezdic": [ - "esmo\nmedical affairs advisor", - "esmo medical affairs staff" + "esmo medical affairs staff", + "esmo\nmedical affairs advisor" ], "esmo\nmedical affairs advisor": [ "and dr svetlana jezdic" @@ -1930,8 +1930,8 @@ "research\nto practice" ], "research": [ - "sakk", - "ukcccr" + "ukcccr", + "sakk" ], "sakk": [ "research" @@ -1970,8 +1970,8 @@ "cancer" ], "non-small-cell lung cancer": [ - "nsclc", - "alesia" + "alesia", + "nsclc" ], "alesia": [ "non-small-cell lung cancer" @@ -1992,9 +1992,9 @@ "chmp" ], "chmp": [ + "products for human use", "retsevmo - summary of opinion", - "tabrecta - summary of opinion", - "products for human use" + "tabrecta - summary of opinion" ], "tabrecta - summary of opinion": [ "chmp" @@ -2046,30 +2046,30 @@ "psmo" ], "psmo": [ - "the philippine society of\nmedical oncology", "and philippine society of medical\noncology", + "the philippine society of\nmedical oncology", "the philippines" ], "singapore": [ "sso" ], "sso": [ - "the singapore society of\noncology", - "singapore" + "singapore", + "the singapore society of\noncology" ], "taiwan": [ "tos" ], "tos": [ - "taiwan", - "the taiwan oncology society" + "the taiwan oncology society", + "taiwan" ], "and thailand": [ "tsco" ], "tsco": [ - "and the\nthai society of clinical oncology", - "and thailand" + "and thailand", + "and the\nthai society of clinical oncology" ], "and the neurotrophic receptor tyrosine\nkinase": [ "ntrk" @@ -2315,8 +2315,8 @@ "lond" ], "lond": [ - "commun", - "cancer commun" + "cancer commun", + "commun" ], "mertinib": [ "osi" @@ -2347,12 +2347,12 @@ "pts" ], "pts": [ - "mo encorafenib plus\n\nbinimetinib in patients", - "therapy in patients", - "versus docetaxel in patients", "p repotrectinib in patients", + "versus docetaxel in patients", + "patients", "binimetinib in patients", - "patients" + "therapy in patients", + "mo encorafenib plus\n\nbinimetinib in patients" ], "mutant advanced non-small cell lung cancer": [ "nsclc" @@ -2447,8 +2447,8 @@ "pacific" ], "pacific": [ - "small-cell lung cancer", - "concurrent chemoradiation therapy" + "concurrent chemoradiation therapy", + "small-cell lung cancer" ], "adaura": [ "chemotherapy" @@ -2871,22 +2871,22 @@ }, "abbreviations": { "esmo": [ - "european\nsociety of medical oncology", + "the following european society for medical oncology", + "the most recent european society for medical oncology", + "european society of medical oncology", "the european society for medical oncology", "european society for medical\noncology", "european society for medical oncology", - "the most recent european society for medical oncology", "european society for\nmedical oncology", - "the following european society for medical oncology", - "european society of medical oncology" + "european\nsociety of medical oncology" ], "asco": [ - "american society of clinical oncology", - "the clinical practice guidelines published herein are provided by the american society of clinical oncology inc", - "american\nsociety of clinical oncology", - "american society of clinical\n\noncology", "this american society of clinical oncology", - "american society of clinical\noncology" + "american society of clinical\n\noncology", + "the clinical practice guidelines published herein are provided by the american society of clinical oncology inc", + "american society of clinical oncology", + "american society of clinical\noncology", + "american\nsociety of clinical oncology" ], "aiom": [ "the italian association of medical oncology", @@ -2898,8 +2898,8 @@ "american cancer centers" ], "glides": [ - "ecision support", - "guidelines into decision\nsupport" + "guidelines into decision\nsupport", + "ecision support" ], "glc": [ "guidelines committee" @@ -2909,12 +2909,12 @@ "magnitude\nof clinical benefit score" ], "ema": [ - "european medicines\nagency", - "european medicines agency" + "european medicines agency", + "european medicines\nagency" ], "sclc": [ - "small cell lung cancer", - "clinical practice guidelines on small cell lung\ncancer" + "clinical practice guidelines on small cell lung\ncancer", + "small cell lung cancer" ], "cco": [ "cancer care ontario" @@ -2923,69 +2923,69 @@ "executive summary of an american society for\nradiation oncology" ], "inst": [ - "sutro biopharma", - "amgen", - "roche", - "merck", - "constellation pharmaceuticals", - "nuvation bio", - "calithera biosciences", - "genentech", - "astex pharmaceuticals", - "merck serono", - "zeneca", - "kline", - "vivace therapeutics", - "heart therapeutics", - "novartis", - "elevation oncology", - "advaxis", - "summit therapeutics", - "takeda", + "bayer", + "trizell", + "macrogenics", "blueprint medicines", - "turning point therapeutics", - "janssen", - "genomics", - "pharmaceuticals", - "immune", - "pfizer", - "polaris", + "bristol myers squibb", + "vivace therapeutics", + "zeneca canada", + "black diamond\ntherapeutics", + "boehringer ingelheim", + "lilly", + "bristol myers\nsquibb", "exelixis", + "revolution medicines", + "jazz pharmaceuticals", + "pfizer", + "dizal\npharma", "bristol myers squibb foundation", - "forward", - "zeneca canada", - "mirati therapeutics", - "puma biotechnology", - "palobiofarma", - "harpoon therapeutics", - "kline canada", - "cullinan oncology", - "trizell", + "dohme", + "guardant health", "arcus biosciences", - "lilly", + "janssen", "therapeutics", - "boehringer ingelheim", + "polaris", + "zeneca", "myers squibb", + "calithera biosciences", + "nuvation bio", + "astex pharmaceuticals", + "advaxis", + "pharmaceuticals", + "merck", + "summit therapeutics", + "turning point therapeutics", + "amgen", "janssen oncology", - "jazz pharmaceuticals", - "black diamond\ntherapeutics", - "astra zeneca", - "dizal\npharma", - "bristol myers squibb", - "dohme", + "palobiofarma", "regeneron", + "kline canada", + "forward", + "novartis", + "mirati therapeutics", + "genomics", + "sutro biopharma", + "immune", + "constellation pharmaceuticals", + "merck serono", + "puma biotechnology", + "kline", + "takeda", + "genentech", "inhibrx", - "guardant health", "verastem", - "bristol myers\nsquibb", - "revolution medicines", - "macrogenics", - "bayer" + "harpoon therapeutics", + "astra zeneca", + "cullinan oncology", + "roche", + "heart therapeutics", + "elevation oncology" ], "ct": [ - "clinicians should use a diagnostic chest computed tomography", "computed tomography", - "the use of\ncomputed tomography" + "the use of\ncomputed tomography", + "clinicians should use a diagnostic chest computed tomography" ], "mri": [ "what is the role of brain magnetic resonance imaging" @@ -2998,11 +2998,11 @@ "pathologists" ], "iaslc": [ - "study of lung cancer", + "the\ninternational association for the study of lung cancer", "international association for the\nstudy of lung cancer", "international association for\nthe study of lung cancer", - "the\ninternational association for the study of lung cancer", "pathology committee chair\nfor international association for the study of lung cancer", + "study of lung cancer", "international association for the\n\nstudy of lung cancer" ], "amp": [ @@ -3018,8 +3018,8 @@ "although the results from the mesothelioma and radical surgery" ], "os": [ - "the median\noverall survival", - "overall survival" + "overall survival", + "the median\noverall survival" ], "elsevier": [ "clinical lung cancer" @@ -3038,11 +3038,11 @@ "prophylactic cranial irradiation" ], "fda": [ - "united states food and drug administration", - "entrectinib received food and\ndrug administration", "osimertinib is approved by both the united states food and\ndrug administration", + "food and drug administration", "these results led to the food\n\nand drug administration", - "food and drug administration" + "united states food and drug administration", + "entrectinib received food and\ndrug administration" ], "crs": [ "cytokine release syndrome" @@ -3051,11 +3051,11 @@ "department of surgical sciences" ], "who": [ - "global statistics", - "the latest world health organization", "global", + "the recent world health organization", "world health organization", - "the recent world health organization" + "the latest world health organization", + "global statistics" ], "lc": [ "these\nguidelines are restricted to lung carcinoid" @@ -3067,8 +3067,8 @@ "uicc": [ "edition of the union for\ninternational cancer control", "union for\ninternational cancer control", - "union for international cancer control", - "union for international\ncancer control" + "union for international\ncancer control", + "union for international cancer control" ], "gep": [ "based on\napproval and recommendations in gastroenteropancreatic" @@ -3077,13 +3077,13 @@ "annals of oncology\n\n\n\nparathyroid hormone" ], "rfa": [ - "palliative surgery\nor radiofrequency ablation", - "for these patients radiofrequency ablation" + "for these patients radiofrequency ablation", + "palliative surgery\nor radiofrequency ablation" ], "recist": [ "cs with response evaluation criteria\nin solid tumours", - "measurements and response assessment should follow response evaluation criteria in solid tumours", - "measurements and response assessment should follow\nresponse evaluation criteria in solid tumours" + "measurements and response assessment should follow\nresponse evaluation criteria in solid tumours", + "measurements and response assessment should follow response evaluation criteria in solid tumours" ], "gemox": [ "oxaliplatin combined with gemcitabine" @@ -3092,8 +3092,8 @@ "lanreotide autogel" ], "chuv": [ - "centre hospitalier universitaire vaudois", - "centre hospitalier universitaire\nvaudois" + "centre hospitalier universitaire\nvaudois", + "centre hospitalier universitaire vaudois" ], "nlst": [ "the much larger national lung cancer screening trial", @@ -3121,8 +3121,8 @@ "for cases with mutation in epidermal growth factor receptor" ], "rtog": [ - "radiation therapy oncology group", - "data from a completed prospective\nradiation therapy oncology group" + "data from a completed prospective\nradiation therapy oncology group", + "radiation therapy oncology group" ], "esge": [ "european society of gastrointestinal endoscopy" @@ -3135,8 +3135,8 @@ "european\nsociety of thoracic surgeons" ], "thoracoscore": [ - "the thoracic surgery scoring system", - "the thoracic surgery scoring\nsystem" + "the thoracic surgery scoring\nsystem", + "the thoracic surgery scoring system" ], "pulmonology": [ "respiratory oncology", @@ -3162,10 +3162,10 @@ "bemeneed" ], "bms": [ - "bristol\nmyers squibb", + "bristol myers\nsquibb", "myers\nsquibb", "bristol myers squibb", - "bristol myers\nsquibb" + "bristol\nmyers squibb" ], "msd": [ "dohme" @@ -3179,8 +3179,8 @@ "clinical practice guideline" ], "escat": [ - "scale for clinical actionability of molecular targets", "scale for clinical actionability of\nmolecular targets", + "scale for clinical actionability of molecular targets", "targets" ], "alk": [ @@ -3218,8 +3218,8 @@ "kline" ], "nvalt": [ - "nederlandse vereniging van artsen voor longziekten en tuberculose", - "lung cancer group and past secretary and current\nchair of the nederlandse vereniging van artsen voor longziekten en tuberculose" + "lung cancer group and past secretary and current\nchair of the nederlandse vereniging van artsen voor longziekten en tuberculose", + "nederlandse vereniging van artsen voor longziekten en tuberculose" ], "atorg": [ "asian\nthoracic oncology research group" @@ -3228,9 +3228,9 @@ "chinese lung\ncancer research foundation limited" ], "csco": [ - "chinese\nsociety of clinical oncology", + "chinese society of clinical oncology", "china", - "chinese society of clinical oncology" + "chinese\nsociety of clinical oncology" ], "hkcf": [ "hong kong cancer fund" @@ -3277,12 +3277,12 @@ "asian adapted" ], "ishmo": [ - "indonesian society\nof hematology and medical oncology", - "indonesia" + "indonesia", + "indonesian society\nof hematology and medical oncology" ], "jsmo": [ - "japanese society of medical oncology", - "japan" + "japan", + "japanese society of medical oncology" ], "ksmo": [ "korea", @@ -3298,16 +3298,16 @@ "philippine society of medical\noncology" ], "sso": [ - "singapore society of\noncology", - "singapore" + "singapore", + "singapore society of\noncology" ], "tos": [ - "taiwan", - "taiwan oncology society" + "taiwan oncology society", + "taiwan" ], "tsco": [ - "thai society of clinical oncology", - "thailand" + "thailand", + "thai society of clinical oncology" ], "ismpo": [ "indian\nsociety of medical and paediatric oncology" @@ -3322,8 +3322,8 @@ "the jaminan kesehatan nasional" ], "fornas": [ - "national standard of\nmedication list", - "na\ntional drug formulary" + "na\ntional drug formulary", + "national standard of\nmedication list" ], "pap": [ "open\n\n\n\nprogram" @@ -3350,8 +3350,8 @@ "ireland oesophagogastric group" ], "lond": [ - "commun", - "cancer commun" + "cancer commun", + "commun" ], "nivo": [ "nivolumab" diff --git a/export_prompts.py b/export_prompts.py new file mode 100644 index 0000000000000000000000000000000000000000..d42569a1b35593cca2e0b12de6d7e9a4e562f067 --- /dev/null +++ b/export_prompts.py @@ -0,0 +1,146 @@ +""" +Script to export agent and validation prompts to a Word document. +""" +from docx import Document +from docx.shared import Pt, RGBColor, Inches +from docx.enum.text import WD_ALIGN_PARAGRAPH +import sys +import os +import re + +# Add the project root to the path +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + + +def extract_system_message_from_agent(): + """Extract SYSTEM_MESSAGE from core/agent.py without importing it.""" + agent_path = os.path.join(os.path.dirname(__file__), 'core', 'agent.py') + with open(agent_path, 'r', encoding='utf-8') as f: + content = f.read() + + # Extract SYSTEM_MESSAGE using regex + match = re.search(r'SYSTEM_MESSAGE = """(.*?)"""', content, re.DOTALL) + if match: + return match.group(1).strip() + else: + raise ValueError("Could not extract SYSTEM_MESSAGE from core/agent.py") + + +def extract_validation_prompt(): + """Extract validation prompt from core/validation.py without importing it.""" + validation_path = os.path.join(os.path.dirname(__file__), 'core', 'validation.py') + with open(validation_path, 'r', encoding='utf-8') as f: + content = f.read() + + # Find the _create_validation_system_prompt method and extract the return string + match = re.search(r'def _create_validation_system_prompt\(self\) -> str:.*?return """(.*?)"""', content, re.DOTALL) + if match: + return match.group(1).strip() + else: + raise ValueError("Could not extract validation prompt from core/validation.py") + + +def create_prompts_document(): + """Create a Word document with both prompts.""" + + # Create a new Document + doc = Document() + + # Add title + title = doc.add_heading('Medical AI System Prompts', 0) + title.alignment = WD_ALIGN_PARAGRAPH.CENTER + + # Add metadata + metadata = doc.add_paragraph() + metadata.add_run('Project: Medical Clinical Decision Support System\n').bold = True + metadata.add_run('Generated: October 19, 2025\n') + metadata.add_run('Description: This document contains the system prompts used by the medical AI assistant.') + + doc.add_page_break() + + # ==================== AGENT PROMPT ==================== + doc.add_heading('1. Agent System Prompt', 1) + + # Add description + desc1 = doc.add_paragraph() + desc1.add_run('Purpose: ').bold = True + desc1.add_run('Main conversational AI agent for clinical decision support\n') + desc1.add_run('Location: ').bold = True + desc1.add_run('core/agent.py\n') + desc1.add_run('Model: ').bold = True + desc1.add_run('GPT-4 (configurable)') + + doc.add_paragraph() # Spacing + + # Add the actual prompt + doc.add_heading('Prompt Content:', 2) + system_message = extract_system_message_from_agent() + prompt_para = doc.add_paragraph(system_message) + prompt_para.style = 'Normal' + + # Format the prompt text + for run in prompt_para.runs: + run.font.size = Pt(10) + run.font.name = 'Courier New' + + doc.add_page_break() + + # ==================== VALIDATION PROMPT ==================== + doc.add_heading('2. Validation System Prompt', 1) + + # Add description + desc2 = doc.add_paragraph() + desc2.add_run('Purpose: ').bold = True + desc2.add_run('Validates generated medical answers for quality assurance\n') + desc2.add_run('Location: ').bold = True + desc2.add_run('core/validation.py\n') + desc2.add_run('Model: ').bold = True + desc2.add_run('GPT-4o') + + doc.add_paragraph() # Spacing + + # Add validation criteria overview + doc.add_heading('Validation Criteria:', 2) + criteria = doc.add_paragraph() + criteria.add_run('The validation prompt evaluates answers on 6 dimensions:\n') + criteria_list = [ + 'Accuracy (0-100%): Factual correctness based on provided documents', + 'Coherence (0-100%): Logical structure, clarity, and readability', + 'Relevance (0-100%): Addresses user\'s question without off-topic information', + 'Completeness (0-100%): Includes all necessary information from documents', + 'Citations/Attribution (0-100%): Proper citation of all claims', + 'Length (0-100%): Appropriate detail without being too brief or verbose' + ] + for criterion in criteria_list: + doc.add_paragraph(criterion, style='List Bullet') + + doc.add_paragraph() # Spacing + + # Add the actual validation prompt + doc.add_heading('Prompt Content:', 2) + validation_prompt = extract_validation_prompt() + + validation_para = doc.add_paragraph(validation_prompt) + validation_para.style = 'Normal' + + # Format the validation prompt text + for run in validation_para.runs: + run.font.size = Pt(10) + run.font.name = 'Courier New' + + # Save the document + output_path = 'Medical_AI_System_Prompts.docx' + doc.save(output_path) + print(f"✓ Document created successfully: {output_path}") + print(f"✓ File location: {os.path.abspath(output_path)}") + + return output_path + + +if __name__ == "__main__": + try: + create_prompts_document() + except Exception as e: + print(f"✗ Error creating document: {str(e)}") + import traceback + traceback.print_exc() diff --git a/logs/app.log b/logs/app.log index ab8486f2039fdcfa47602f201819a356144c2721..928d6a2d0e1c1700bc0b720d8a7aab7f9217b6e7 100644 --- a/logs/app.log +++ b/logs/app.log @@ -6012,3 +6012,3075 @@ AttributeError: 'ConversationTracker' object has no attribute 'add_turn' 2025-10-22 17:32:45,430 - AgenticMedicalRAG - INFO - LLM initialized successfully 2025-10-22 17:32:45,430 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) 2025-10-22 17:32:45,430 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-23 13:14:45,313 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-23 13:14:47,787 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-23 13:14:48,137 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-23 13:14:48,138 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-23 13:14:48,138 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-23 13:14:48,138 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-23 13:15:01,841 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-23 13:15:01,841 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-23 13:15:01,841 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-23 13:15:01,841 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-23 13:15:01,842 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-23 13:15:02,192 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-23 13:15:02,218 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-23 13:15:02,218 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-23 13:15:02,378 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-23 13:15:02,379 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-23 13:15:02,379 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-23 13:15:02,379 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-23 13:15:04,726 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-23 13:15:04,726 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-23 13:15:04,726 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-23 13:15:04,727 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-23 13:15:05,470 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-23 13:15:05,471 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-23 13:15:05,471 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-23 13:18:07,659 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): what is the guidelines recommendation for small ce... +2025-10-23 13:18:10,266 - AgenticMedicalRAG - INFO - Hybrid search returned 26 unique documents (query expansion: True) +2025-10-23 13:18:10,323 - AgenticMedicalRAG - INFO - Enriched 8 documents with surrounding context pages +2025-10-23 13:18:10,323 - AgenticMedicalRAG - INFO - Retrieved 26 documents, added 30 context pages +2025-10-23 13:18:22,397 - AgenticMedicalRAG - INFO - Successfully processed user input: what is the guidelines recommendation for small ce... +2025-10-23 13:18:22,397 - AgenticMedicalRAG - INFO - Performing background validation... +2025-10-23 13:18:23,073 - AgenticMedicalRAG - INFO - Medical answer validator initialized successfully +2025-10-23 13:18:23,074 - AgenticMedicalRAG - INFO - GitHub storage initialized for MoazEldsouky/cloud-data-store +2025-10-23 13:18:24,504 - AgenticMedicalRAG - INFO - Found 14 existing evaluations in GitHub +2025-10-23 13:18:24,505 - AgenticMedicalRAG - INFO - Next interaction ID will be: 15 +2025-10-23 13:18:24,505 - AgenticMedicalRAG - INFO - Starting validation for interaction 15 +2025-10-23 13:18:34,886 - AgenticMedicalRAG - INFO - Loading existing evaluations: 14 found +2025-10-23 13:18:34,886 - AgenticMedicalRAG - INFO - Adding new evaluation with ID: 15 +2025-10-23 13:18:57,907 - AgenticMedicalRAG - INFO - Successfully uploaded medical_data/evaluation_results.json to GitHub +2025-10-23 13:18:57,909 - AgenticMedicalRAG - INFO - Successfully saved evaluation. Total evaluations now: 15 +2025-10-23 13:18:57,909 - AgenticMedicalRAG - INFO - Evaluation saved to GitHub with ID: 15 +2025-10-23 13:18:57,910 - AgenticMedicalRAG - INFO - Background validation completed - Interaction ID: 15 +2025-10-23 13:18:57,910 - AgenticMedicalRAG - INFO - Validation scores - Overall: 90/100, Accuracy: 95/100, Coherence: 90/100, Relevance: 88/100 +2025-10-23 13:51:00,226 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-23 13:51:00,843 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-23 13:51:01,055 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-23 13:51:01,056 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-23 13:51:01,056 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-23 13:51:01,056 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-23 13:51:07,222 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-23 13:51:07,223 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-23 13:51:07,223 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-23 13:51:07,223 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-23 13:51:07,223 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-23 13:51:07,351 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-23 13:51:07,361 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-23 13:51:07,361 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-23 13:51:07,521 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-23 13:51:07,521 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-23 13:51:07,522 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-23 13:51:07,522 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-23 13:51:09,874 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-23 13:51:09,874 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-23 13:51:09,874 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-23 13:51:09,874 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-23 13:51:10,576 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-23 13:51:10,576 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-23 13:51:10,577 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-23 13:52:27,568 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): what is the guidelines recommendation for small ce... +2025-10-23 13:52:30,422 - AgenticMedicalRAG - INFO - Hybrid search returned 19 unique documents (query expansion: True) +2025-10-23 13:52:30,466 - AgenticMedicalRAG - INFO - Enriched 8 documents with surrounding context pages +2025-10-23 13:52:30,467 - AgenticMedicalRAG - INFO - Retrieved 19 documents, added 30 context pages +2025-10-23 13:52:35,534 - AgenticMedicalRAG - INFO - Hybrid search returned 11 unique documents (query expansion: True) +2025-10-23 13:52:35,617 - AgenticMedicalRAG - INFO - Enriched 7 documents with surrounding context pages +2025-10-23 13:52:35,617 - AgenticMedicalRAG - INFO - Retrieved 11 documents, added 22 context pages +2025-10-23 13:52:35,796 - AgenticMedicalRAG - INFO - Hybrid search returned 16 unique documents (query expansion: True) +2025-10-23 13:52:35,863 - AgenticMedicalRAG - INFO - Enriched 6 documents with surrounding context pages +2025-10-23 13:52:35,864 - AgenticMedicalRAG - INFO - Retrieved 16 documents, added 22 context pages +2025-10-23 13:52:36,043 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: True) +2025-10-23 13:52:36,044 - AgenticMedicalRAG - INFO - Retrieved 0 documents, added 0 context pages +2025-10-23 13:52:51,240 - AgenticMedicalRAG - INFO - Performing background validation for streaming response... +2025-10-23 13:52:51,241 - AgenticMedicalRAG - INFO - Skipping validation: insufficient context +2025-10-23 13:52:51,242 - AgenticMedicalRAG - INFO - Successfully processed user input: what is the guidelines recommendation for small ce... +2025-10-23 13:53:30,326 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): What is the treatment for NSCLC?... +2025-10-23 13:53:32,221 - AgenticMedicalRAG - INFO - Hybrid search returned 28 unique documents (query expansion: True) +2025-10-23 13:53:32,237 - AgenticMedicalRAG - INFO - Enriched 8 documents with surrounding context pages +2025-10-23 13:53:32,238 - AgenticMedicalRAG - INFO - Retrieved 28 documents, added 30 context pages +2025-10-23 13:54:02,119 - AgenticMedicalRAG - INFO - Performing background validation for streaming response... +2025-10-23 13:54:02,462 - AgenticMedicalRAG - INFO - Medical answer validator initialized successfully +2025-10-23 13:54:02,462 - AgenticMedicalRAG - INFO - GitHub storage initialized for MoazEldsouky/cloud-data-store +2025-10-23 13:54:03,457 - AgenticMedicalRAG - INFO - Found 1 existing evaluations in GitHub +2025-10-23 13:54:03,457 - AgenticMedicalRAG - INFO - Next interaction ID will be: 2 +2025-10-23 13:54:03,457 - AgenticMedicalRAG - INFO - Starting validation for interaction 2 +2025-10-23 13:54:18,872 - AgenticMedicalRAG - INFO - Loading existing evaluations: 1 found +2025-10-23 13:54:18,873 - AgenticMedicalRAG - INFO - Adding new evaluation with ID: 2 +2025-10-23 13:54:20,842 - AgenticMedicalRAG - INFO - Successfully uploaded medical_data/evaluation_results.json to GitHub +2025-10-23 13:54:20,842 - AgenticMedicalRAG - INFO - Successfully saved evaluation. Total evaluations now: 2 +2025-10-23 13:54:20,843 - AgenticMedicalRAG - INFO - Evaluation saved to GitHub with ID: 2 +2025-10-23 13:54:20,843 - AgenticMedicalRAG - INFO - Background validation completed - Interaction ID: 2 +2025-10-23 13:54:20,843 - AgenticMedicalRAG - INFO - Validation scores - Overall: 90/100, Accuracy: 95/100, Coherence: 90/100, Relevance: 88/100 +2025-10-23 13:54:20,844 - AgenticMedicalRAG - INFO - Successfully processed user input: What is the treatment for NSCLC?... +2025-10-23 13:54:20,846 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): What does the esmo say about this?... +2025-10-23 13:54:22,306 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: True) +2025-10-23 13:54:22,334 - AgenticMedicalRAG - INFO - Enriched 2 documents with surrounding context pages +2025-10-23 13:54:22,334 - AgenticMedicalRAG - INFO - Retrieved 2 documents, added 8 context pages +2025-10-23 13:54:27,779 - AgenticMedicalRAG - INFO - Performing background validation for streaming response... +2025-10-23 13:54:28,391 - AgenticMedicalRAG - INFO - Found 2 existing evaluations in GitHub +2025-10-23 13:54:28,392 - AgenticMedicalRAG - INFO - Next interaction ID will be: 3 +2025-10-23 13:54:28,392 - AgenticMedicalRAG - INFO - Starting validation for interaction 3 +2025-10-23 13:54:40,646 - AgenticMedicalRAG - INFO - Loading existing evaluations: 2 found +2025-10-23 13:54:40,646 - AgenticMedicalRAG - INFO - Adding new evaluation with ID: 3 +2025-10-23 13:54:44,633 - AgenticMedicalRAG - INFO - Successfully uploaded medical_data/evaluation_results.json to GitHub +2025-10-23 13:54:44,634 - AgenticMedicalRAG - INFO - Successfully saved evaluation. Total evaluations now: 3 +2025-10-23 13:54:44,634 - AgenticMedicalRAG - INFO - Evaluation saved to GitHub with ID: 3 +2025-10-23 13:54:44,634 - AgenticMedicalRAG - INFO - Background validation completed - Interaction ID: 3 +2025-10-23 13:54:44,635 - AgenticMedicalRAG - INFO - Validation scores - Overall: 90/100, Accuracy: 95/100, Coherence: 90/100, Relevance: 88/100 +2025-10-23 13:54:44,635 - AgenticMedicalRAG - INFO - Successfully processed user input: What does the esmo say about this?... +2025-10-23 14:17:45,912 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-23 14:17:46,428 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-23 14:17:46,599 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-23 14:17:46,600 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-23 14:17:46,600 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-23 14:17:46,600 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-23 14:17:52,051 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-23 14:17:52,051 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-23 14:17:52,051 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-23 14:17:52,051 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-23 14:17:52,052 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-23 14:17:52,095 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-23 14:17:52,104 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-23 14:17:52,105 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-23 14:17:52,262 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-23 14:17:52,262 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-23 14:17:52,262 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-23 14:17:52,263 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-23 14:17:55,307 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-23 14:17:55,307 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-23 14:17:55,308 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-23 14:17:55,308 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-23 14:17:56,397 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-23 14:17:56,397 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-23 14:17:56,398 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-23 14:20:06,864 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): What is the treatment for NSCLC?... +2025-10-23 14:20:09,105 - AgenticMedicalRAG - INFO - Hybrid search returned 29 unique documents (query expansion: True) +2025-10-23 14:20:09,186 - AgenticMedicalRAG - INFO - Enriched 8 documents with surrounding context pages +2025-10-23 14:20:09,186 - AgenticMedicalRAG - INFO - Retrieved 29 documents, added 32 context pages +2025-10-23 14:20:23,837 - AgenticMedicalRAG - INFO - Performing background validation for streaming response... +2025-10-23 14:20:24,602 - AgenticMedicalRAG - INFO - Medical answer validator initialized successfully +2025-10-23 14:20:24,602 - AgenticMedicalRAG - INFO - GitHub storage initialized for MoazEldsouky/cloud-data-store +2025-10-23 14:20:25,945 - AgenticMedicalRAG - INFO - Found 3 existing evaluations in GitHub +2025-10-23 14:20:25,946 - AgenticMedicalRAG - INFO - Next interaction ID will be: 4 +2025-10-23 14:20:25,946 - AgenticMedicalRAG - INFO - Starting validation for interaction 4 +2025-10-23 14:20:39,285 - AgenticMedicalRAG - INFO - Attempt 1/3: Loading existing evaluations from GitHub... +2025-10-23 14:20:40,061 - AgenticMedicalRAG - INFO - Successfully loaded 3 existing evaluations +2025-10-23 14:20:40,063 - AgenticMedicalRAG - INFO - Adding new evaluation with ID: 4 +2025-10-23 14:20:40,063 - AgenticMedicalRAG - INFO - Appended new evaluation. Total count: 4 +2025-10-23 14:20:42,598 - AgenticMedicalRAG - INFO - Successfully uploaded medical_data/evaluation_results.json to GitHub +2025-10-23 14:20:42,599 - AgenticMedicalRAG - INFO - ✓ Successfully saved evaluation 4. Total evaluations now: 4 +2025-10-23 14:20:42,599 - AgenticMedicalRAG - INFO - Evaluation saved to GitHub with ID: 4 +2025-10-23 14:20:42,600 - AgenticMedicalRAG - INFO - Background validation completed - Interaction ID: 4 +2025-10-23 14:20:42,600 - AgenticMedicalRAG - INFO - Validation scores - Overall: 90/100, Accuracy: 95/100, Coherence: 90/100, Relevance: 88/100 +2025-10-23 14:20:42,600 - AgenticMedicalRAG - INFO - Successfully processed user input: What is the treatment for NSCLC?... +2025-10-23 14:32:36,549 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-23 14:32:37,024 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-23 14:32:37,181 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-23 14:32:37,182 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-23 14:32:37,182 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-23 14:32:37,182 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-23 14:32:42,138 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-23 14:32:42,138 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-23 14:32:42,139 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-23 14:32:42,139 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-23 14:32:42,139 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-23 14:32:42,189 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-23 14:32:42,199 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-23 14:32:42,199 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-23 14:32:42,364 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-23 14:32:42,365 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-23 14:32:42,365 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-23 14:32:42,365 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-23 14:32:46,343 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-23 14:32:46,344 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-23 14:32:46,344 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-23 14:32:46,344 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-23 14:32:47,518 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-23 14:32:47,518 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-23 14:32:47,518 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-24 16:48:11,990 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-24 16:48:13,561 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-24 16:48:13,961 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-24 16:48:13,962 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-24 16:48:13,962 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-24 16:48:13,963 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-24 16:48:25,539 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-24 16:48:25,539 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-24 16:48:25,539 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-24 16:48:25,540 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-24 16:48:25,540 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-24 16:48:25,686 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-24 16:48:25,702 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-24 16:48:25,702 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-24 16:48:26,043 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-24 16:48:26,043 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-24 16:48:26,043 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-24 16:48:26,044 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-24 16:48:29,624 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-24 16:48:29,624 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-24 16:48:29,625 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-24 16:48:29,625 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-24 16:48:30,684 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-24 16:48:30,684 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-24 16:48:30,684 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-24 17:00:36,876 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): How should stage III NSCLC with EGFR mutations be ... +2025-10-24 17:00:42,533 - AgenticMedicalRAG - INFO - Hybrid search returned 30 unique documents (query expansion: True) +2025-10-24 17:00:42,649 - AgenticMedicalRAG - INFO - Enriched 7 documents with surrounding context pages +2025-10-24 17:00:42,649 - AgenticMedicalRAG - INFO - Retrieved 30 documents, added 26 context pages +2025-10-24 17:01:00,651 - AgenticMedicalRAG - ERROR - Unexpected error in run_agent_streaming: peer closed connection without sending complete message body (incomplete chunked read) +2025-10-24 17:01:00,709 - AgenticMedicalRAG - ERROR - Traceback: Traceback (most recent call last): + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\httpx\_transports\default.py", line 101, in map_httpcore_exceptions + yield + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\httpx\_transports\default.py", line 127, in __iter__ + for part in self._httpcore_stream: + ^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\httpcore\_sync\connection_pool.py", line 407, in __iter__ + raise exc from None + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\httpcore\_sync\connection_pool.py", line 403, in __iter__ + for part in self._stream: + ^^^^^^^^^^^^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\httpcore\_sync\http11.py", line 342, in __iter__ + raise exc + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\httpcore\_sync\http11.py", line 334, in __iter__ + for chunk in self._connection._receive_response_body(**kwargs): + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\httpcore\_sync\http11.py", line 203, in _receive_response_body + event = self._receive_event(timeout=timeout) + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\httpcore\_sync\http11.py", line 213, in _receive_event + with map_exceptions({h11.RemoteProtocolError: RemoteProtocolError}): + ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Program Files\Python313\Lib\contextlib.py", line 162, in __exit__ + self.gen.throw(value) + ~~~~~~~~~~~~~~^^^^^^^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\httpcore\_exceptions.py", line 14, in map_exceptions + raise to_exc(exc) from exc +httpcore.RemoteProtocolError: peer closed connection without sending complete message body (incomplete chunked read) + +The above exception was the direct cause of the following exception: + +Traceback (most recent call last): + File "d:\Work\API\core\agent.py", line 488, in run_agent_streaming + response = await task + ^^^^^^^^^^ + File "C:\Program Files\Python313\Lib\concurrent\futures\thread.py", line 59, in run + result = self.fn(*self.args, **self.kwargs) + File "d:\Work\API\core\agent.py", line 458, in run_sync + return get_agent_executor().invoke( + ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ + { + ^ + ...<3 lines>... + config={"callbacks": [streaming_handler]}, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ) + ^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\langchain\chains\base.py", line 165, in invoke + self._call(inputs, run_manager=run_manager) + ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\langchain\agents\agent.py", line 1625, in _call + next_step_output = self._take_next_step( + name_to_tool_map, + ...<3 lines>... + run_manager=run_manager, + ) + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\langchain\agents\agent.py", line 1325, in _take_next_step + list( + ~~~~^ + self._iter_next_step( + ^^^^^^^^^^^^^^^^^^^^^ + ...<5 lines>... + ), + ^^ + ), + ^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\langchain\agents\agent.py", line 1352, in _iter_next_step + output = self._action_agent.plan( + intermediate_steps, + callbacks=run_manager.get_child() if run_manager else None, + **inputs, + ) + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\langchain\agents\agent.py", line 573, in plan + for chunk in self.runnable.stream(inputs, config={"callbacks": callbacks}): + ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\langchain_core\runnables\base.py", line 3649, in stream + yield from self.transform(iter([input]), config, **kwargs) + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\langchain_core\runnables\base.py", line 3635, in transform + yield from self._transform_stream_with_config( + ...<4 lines>... + ) + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\langchain_core\runnables\base.py", line 2369, in _transform_stream_with_config + chunk: Output = context.run(next, iterator) + ~~~~~~~~~~~^^^^^^^^^^^^^^^^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\langchain_core\runnables\base.py", line 3594, in _transform + yield from final_pipeline + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\langchain_core\runnables\base.py", line 1568, in transform + for ichunk in input: + ^^^^^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\langchain_core\runnables\base.py", line 5926, in transform + yield from self.bound.transform( + ...<3 lines>... + ) + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\langchain_core\runnables\base.py", line 1586, in transform + yield from self.stream(final, config, **kwargs) + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\langchain_core\language_models\chat_models.py", line 522, in stream + for chunk in self._stream(input_messages, stop=stop, **kwargs): + ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\langchain_openai\chat_models\base.py", line 1049, in _stream + for chunk in response: + ^^^^^^^^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\openai\_streaming.py", line 46, in __iter__ + for item in self._iterator: + ^^^^^^^^^^^^^^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\openai\_streaming.py", line 58, in __stream__ + for sse in iterator: + ^^^^^^^^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\openai\_streaming.py", line 50, in _iter_events + yield from self._decoder.iter_bytes(self.response.iter_bytes()) + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\openai\_streaming.py", line 280, in iter_bytes + for chunk in self._iter_chunks(iterator): + ~~~~~~~~~~~~~~~~~^^^^^^^^^^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\openai\_streaming.py", line 291, in _iter_chunks + for chunk in iterator: + ^^^^^^^^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\httpx\_models.py", line 897, in iter_bytes + for raw_bytes in self.iter_raw(): + ~~~~~~~~~~~~~^^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\httpx\_models.py", line 951, in iter_raw + for raw_stream_bytes in self.stream: + ^^^^^^^^^^^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\httpx\_client.py", line 153, in __iter__ + for chunk in self._stream: + ^^^^^^^^^^^^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\httpx\_transports\default.py", line 126, in __iter__ + with map_httpcore_exceptions(): + ~~~~~~~~~~~~~~~~~~~~~~~^^ + File "C:\Program Files\Python313\Lib\contextlib.py", line 162, in __exit__ + self.gen.throw(value) + ~~~~~~~~~~~~~~^^^^^^^ + File "C:\Users\moaze\AppData\Roaming\Python\Python313\site-packages\httpx\_transports\default.py", line 118, in map_httpcore_exceptions + raise mapped_exc(message) from exc +httpx.RemoteProtocolError: peer closed connection without sending complete message body (incomplete chunked read) + +2025-10-24 17:09:41,853 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-24 17:09:45,035 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-24 17:09:45,468 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-24 17:09:45,469 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-24 17:09:45,469 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-24 17:09:45,470 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-24 17:10:07,994 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-24 17:10:07,994 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-24 17:10:07,994 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-24 17:10:07,995 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-24 17:10:07,995 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-24 17:10:08,509 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-24 17:10:08,532 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-24 17:10:08,533 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-24 17:10:08,906 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-24 17:10:08,907 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-24 17:10:08,907 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-24 17:10:08,907 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-24 17:10:13,814 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-24 17:10:13,815 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-24 17:10:13,815 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-24 17:10:13,816 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-24 17:10:15,191 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-24 17:10:15,192 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-24 17:10:15,192 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-24 17:10:19,438 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): How should stage III NSCLC with EGFR mutations be ... +2025-10-24 17:10:23,684 - AgenticMedicalRAG - INFO - Hybrid search returned 30 unique documents (query expansion: True) +2025-10-24 17:10:23,803 - AgenticMedicalRAG - INFO - Enriched 7 documents with surrounding context pages +2025-10-24 17:10:23,804 - AgenticMedicalRAG - INFO - Retrieved 30 documents, added 26 context pages +2025-10-24 17:10:48,327 - AgenticMedicalRAG - INFO - Performing background validation for streaming response... +2025-10-24 17:10:49,187 - AgenticMedicalRAG - INFO - Medical answer validator initialized successfully +2025-10-24 17:10:49,188 - AgenticMedicalRAG - INFO - GitHub storage initialized for MoazEldsouky/cloud-data-store +2025-10-24 17:10:50,209 - AgenticMedicalRAG - INFO - Found 4 existing evaluations in GitHub +2025-10-24 17:10:50,210 - AgenticMedicalRAG - INFO - Next interaction ID will be: 5 +2025-10-24 17:10:50,210 - AgenticMedicalRAG - INFO - Starting validation for interaction 5 +2025-10-24 17:11:15,526 - AgenticMedicalRAG - INFO - Attempting to save evaluation with ID: 5 +2025-10-24 17:11:15,526 - AgenticMedicalRAG - INFO - GitHub storage instance obtained, calling save_validation_results... +2025-10-24 17:11:15,526 - AgenticMedicalRAG - INFO - Attempt 1/3: Loading existing evaluations from GitHub... +2025-10-24 17:11:26,578 - AgenticMedicalRAG - INFO - Successfully loaded 4 existing evaluations +2025-10-24 17:11:26,578 - AgenticMedicalRAG - INFO - Adding new evaluation with ID: 5 +2025-10-24 17:11:26,578 - AgenticMedicalRAG - INFO - Appended new evaluation. Total count: 5 +2025-10-24 17:11:27,218 - AgenticMedicalRAG - INFO - Uploading to GitHub: medical_data/evaluation_results.json (size: 446055 bytes) +2025-10-24 17:11:43,132 - AgenticMedicalRAG - INFO - ✓ Successfully uploaded medical_data/evaluation_results.json to GitHub +2025-10-24 17:11:43,132 - AgenticMedicalRAG - INFO - ✓ Successfully saved evaluation 5. Total evaluations now: 5 +2025-10-24 17:11:43,133 - AgenticMedicalRAG - INFO - ✓ Evaluation saved to GitHub successfully with ID: 5 +2025-10-24 17:11:43,133 - AgenticMedicalRAG - INFO - Background validation completed - Interaction ID: 5 +2025-10-24 17:11:43,133 - AgenticMedicalRAG - INFO - Validation scores - Overall: 90/100, Accuracy: 95/100, Coherence: 90/100, Relevance: 88/100 +2025-10-24 17:11:43,134 - AgenticMedicalRAG - INFO - Successfully processed user input: How should stage III NSCLC with EGFR mutations be ... +2025-10-24 17:16:58,125 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): What is the recommended first-line treatment for a... +2025-10-24 17:17:00,973 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: True) +2025-10-24 17:17:00,997 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-10-24 17:17:00,997 - AgenticMedicalRAG - INFO - Retrieved 1 documents, added 2 context pages +2025-10-24 17:17:09,766 - AgenticMedicalRAG - INFO - Performing background validation for streaming response... +2025-10-24 17:17:10,710 - AgenticMedicalRAG - INFO - Found 5 existing evaluations in GitHub +2025-10-24 17:17:10,710 - AgenticMedicalRAG - INFO - Next interaction ID will be: 6 +2025-10-24 17:17:10,710 - AgenticMedicalRAG - INFO - Starting validation for interaction 6 +2025-10-24 17:17:19,893 - AgenticMedicalRAG - INFO - Attempting to save evaluation with ID: 6 +2025-10-24 17:17:19,893 - AgenticMedicalRAG - INFO - GitHub storage instance obtained, calling save_validation_results... +2025-10-24 17:17:19,894 - AgenticMedicalRAG - INFO - Attempt 1/3: Loading existing evaluations from GitHub... +2025-10-24 17:17:21,307 - AgenticMedicalRAG - INFO - Successfully loaded 5 existing evaluations +2025-10-24 17:17:21,308 - AgenticMedicalRAG - INFO - Adding new evaluation with ID: 6 +2025-10-24 17:17:21,308 - AgenticMedicalRAG - INFO - Appended new evaluation. Total count: 6 +2025-10-24 17:17:24,173 - AgenticMedicalRAG - INFO - Uploading to GitHub: medical_data/evaluation_results.json (size: 454269 bytes) +2025-10-24 17:17:27,553 - AgenticMedicalRAG - INFO - ✓ Successfully uploaded medical_data/evaluation_results.json to GitHub +2025-10-24 17:17:27,554 - AgenticMedicalRAG - INFO - ✓ Successfully saved evaluation 6. Total evaluations now: 6 +2025-10-24 17:17:27,555 - AgenticMedicalRAG - INFO - ✓ Evaluation saved to GitHub successfully with ID: 6 +2025-10-24 17:17:27,555 - AgenticMedicalRAG - INFO - Background validation completed - Interaction ID: 6 +2025-10-24 17:17:27,556 - AgenticMedicalRAG - INFO - Validation scores - Overall: 90/100, Accuracy: 95/100, Coherence: 90/100, Relevance: 88/100 +2025-10-24 17:17:27,557 - AgenticMedicalRAG - INFO - Successfully processed user input: What is the recommended first-line treatment for a... +2025-10-25 09:32:36,294 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 09:32:37,921 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 09:32:38,460 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 09:32:38,461 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 09:32:38,462 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 09:32:38,462 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 09:32:49,078 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 09:32:49,079 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-25 09:32:49,079 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-25 09:32:49,079 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 09:32:49,079 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 09:32:49,249 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 09:32:49,275 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 09:32:49,275 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 09:32:49,726 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 09:32:49,727 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 09:32:49,727 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-25 09:32:49,727 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-25 09:32:54,496 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-25 09:32:54,497 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-25 09:32:54,497 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-25 09:32:54,497 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-25 09:32:55,857 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-25 09:32:55,857 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-25 09:32:55,857 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-25 10:00:14,622 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): What is the recommended first-line treatment for a... +2025-10-25 10:00:20,256 - AgenticMedicalRAG - WARNING - Rate limit exceeded. Retrying in 2 seconds... (Attempt 1/3) +2025-10-25 10:00:22,257 - AgenticMedicalRAG - INFO - Processing user input (attempt 2): What is the recommended first-line treatment for a... +2025-10-25 10:00:25,390 - AgenticMedicalRAG - WARNING - Rate limit exceeded. Retrying in 4 seconds... (Attempt 2/3) +2025-10-25 10:00:29,391 - AgenticMedicalRAG - INFO - Processing user input (attempt 3): What is the recommended first-line treatment for a... +2025-10-25 10:00:32,250 - AgenticMedicalRAG - WARNING - Rate limit exceeded. Retrying in 8 seconds... (Attempt 3/3) +2025-10-25 10:05:46,520 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 10:05:49,904 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 10:05:50,237 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 10:05:50,238 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 10:05:50,240 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 10:05:50,240 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 10:06:05,945 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 10:06:05,945 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-25 10:06:05,946 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-25 10:06:05,946 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 10:06:05,946 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 10:06:06,362 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 10:06:06,377 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 10:06:06,377 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 10:06:06,583 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 10:06:06,584 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 10:06:06,584 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-25 10:06:06,584 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-25 10:06:09,470 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-25 10:06:09,470 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-25 10:06:09,471 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-25 10:06:09,471 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-25 10:06:10,242 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-25 10:06:10,242 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-25 10:06:10,242 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-25 12:24:34,692 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 12:24:35,213 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 12:24:35,387 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 12:24:35,387 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 12:24:35,388 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 12:24:35,388 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 12:24:40,730 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 12:24:40,730 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-25 12:24:40,730 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-25 12:24:40,730 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 12:24:40,731 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 12:24:40,770 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 12:24:40,781 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 12:24:40,781 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 12:24:40,959 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 12:24:40,959 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 12:24:40,959 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-25 12:24:40,959 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-25 12:24:43,359 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-25 12:24:43,359 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-25 12:24:43,359 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-25 12:24:43,360 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-25 12:24:43,925 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-25 12:24:43,926 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-25 12:24:43,926 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-25 12:25:01,700 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): hi... +2025-10-25 12:25:04,240 - AgenticMedicalRAG - INFO - Performing background validation for streaming response... +2025-10-25 12:25:04,240 - AgenticMedicalRAG - INFO - Skipping validation: insufficient context +2025-10-25 12:25:04,241 - AgenticMedicalRAG - INFO - Successfully processed user input: hi... +2025-10-25 12:25:34,104 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): my name is moaz... +2025-10-25 12:25:35,846 - AgenticMedicalRAG - INFO - Performing background validation for streaming response... +2025-10-25 12:25:35,847 - AgenticMedicalRAG - INFO - Skipping validation: insufficient context +2025-10-25 12:25:35,847 - AgenticMedicalRAG - INFO - Successfully processed user input: my name is moaz... +2025-10-25 12:25:52,401 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 12:25:52,889 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 12:25:53,052 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 12:25:53,053 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 12:25:53,053 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 12:25:53,053 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 12:25:59,307 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 12:25:59,308 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-25 12:25:59,308 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-25 12:25:59,308 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 12:25:59,308 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 12:25:59,348 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 12:25:59,359 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 12:25:59,359 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 12:25:59,544 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 12:25:59,544 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 12:25:59,545 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-25 12:25:59,545 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-25 12:26:02,040 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-25 12:26:02,040 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-25 12:26:02,041 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-25 12:26:02,041 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-25 12:26:03,214 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-25 12:26:03,215 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-25 12:26:03,215 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-25 12:26:11,024 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): hi... +2025-10-25 12:26:15,398 - AgenticMedicalRAG - WARNING - Rate limit exceeded. Retrying in 2 seconds... (Attempt 1/3) +2025-10-25 12:26:17,401 - AgenticMedicalRAG - INFO - Processing user input (attempt 2): hi... +2025-10-25 12:26:20,231 - AgenticMedicalRAG - WARNING - Rate limit exceeded. Retrying in 4 seconds... (Attempt 2/3) +2025-10-25 12:26:24,232 - AgenticMedicalRAG - INFO - Processing user input (attempt 3): hi... +2025-10-25 12:26:27,797 - AgenticMedicalRAG - WARNING - Rate limit exceeded. Retrying in 8 seconds... (Attempt 3/3) +2025-10-25 12:26:35,799 - AgenticMedicalRAG - INFO - Processing user input (attempt 4): hi... +2025-10-25 12:26:38,283 - AgenticMedicalRAG - WARNING - Rate limit exceeded. Retrying in 16 seconds... (Attempt 4/3) +2025-10-25 12:26:38,283 - AgenticMedicalRAG - ERROR - Rate limit exceeded after maximum retries +2025-10-25 12:27:16,371 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 12:27:16,840 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 12:27:16,994 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 12:27:16,994 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 12:27:16,995 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 12:27:16,995 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 12:27:22,389 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 12:27:22,389 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-25 12:27:22,390 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-25 12:27:22,390 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 12:27:22,390 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 12:27:22,484 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 12:27:22,510 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 12:27:22,510 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 12:27:22,794 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 12:27:22,795 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 12:27:22,795 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-25 12:27:22,795 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-25 12:27:26,803 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-25 12:27:26,803 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-25 12:27:26,803 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-25 12:27:26,804 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-25 12:27:27,917 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-25 12:27:27,917 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-25 12:27:27,918 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-25 12:27:39,641 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): What is the recommended first-line treatment for a... +2025-10-25 12:27:42,820 - AgenticMedicalRAG - INFO - Hybrid search returned 18 unique documents (query expansion: True) +2025-10-25 12:27:42,881 - AgenticMedicalRAG - INFO - Enriched 6 documents with surrounding context pages +2025-10-25 12:27:42,881 - AgenticMedicalRAG - INFO - Retrieved 18 documents, added 22 context pages +2025-10-25 12:27:43,505 - AgenticMedicalRAG - ERROR - OpenAI API/Connection error (APIStatusError): Error code: 413 - {'error': {'code': 'tokens_limit_reached', 'message': 'Request body too large for gpt-4o model. Max size: 8000 tokens.', 'details': 'Request body too large for gpt-4o model. Max size: 8000 tokens.'}} +2025-10-25 12:27:43,505 - AgenticMedicalRAG - INFO - Retrying after 2 seconds... (Attempt 1/3) +2025-10-25 12:27:45,507 - AgenticMedicalRAG - INFO - Processing user input (attempt 2): What is the recommended first-line treatment for a... +2025-10-25 12:27:46,599 - AgenticMedicalRAG - INFO - Hybrid search returned 18 unique documents (query expansion: True) +2025-10-25 12:27:46,601 - AgenticMedicalRAG - INFO - Enriched 6 documents with surrounding context pages +2025-10-25 12:27:46,601 - AgenticMedicalRAG - INFO - Retrieved 18 documents, added 22 context pages +2025-10-25 12:27:46,926 - AgenticMedicalRAG - ERROR - OpenAI API/Connection error (APIStatusError): Error code: 413 - {'error': {'code': 'tokens_limit_reached', 'message': 'Request body too large for gpt-4o model. Max size: 8000 tokens.', 'details': 'Request body too large for gpt-4o model. Max size: 8000 tokens.'}} +2025-10-25 12:27:46,926 - AgenticMedicalRAG - INFO - Retrying after 4 seconds... (Attempt 2/3) +2025-10-25 12:27:50,927 - AgenticMedicalRAG - INFO - Processing user input (attempt 3): What is the recommended first-line treatment for a... +2025-10-25 12:27:51,960 - AgenticMedicalRAG - INFO - Hybrid search returned 18 unique documents (query expansion: True) +2025-10-25 12:27:51,962 - AgenticMedicalRAG - INFO - Enriched 6 documents with surrounding context pages +2025-10-25 12:27:51,962 - AgenticMedicalRAG - INFO - Retrieved 18 documents, added 22 context pages +2025-10-25 12:27:52,313 - AgenticMedicalRAG - ERROR - OpenAI API/Connection error (APIStatusError): Error code: 413 - {'error': {'code': 'tokens_limit_reached', 'message': 'Request body too large for gpt-4o model. Max size: 8000 tokens.', 'details': 'Request body too large for gpt-4o model. Max size: 8000 tokens.'}} +2025-10-25 12:27:52,314 - AgenticMedicalRAG - INFO - Retrying after 8 seconds... (Attempt 3/3) +2025-10-25 12:28:00,315 - AgenticMedicalRAG - INFO - Processing user input (attempt 4): What is the recommended first-line treatment for a... +2025-10-25 12:28:02,230 - AgenticMedicalRAG - INFO - Hybrid search returned 18 unique documents (query expansion: True) +2025-10-25 12:28:02,231 - AgenticMedicalRAG - INFO - Enriched 6 documents with surrounding context pages +2025-10-25 12:28:02,232 - AgenticMedicalRAG - INFO - Retrieved 18 documents, added 22 context pages +2025-10-25 12:28:02,805 - AgenticMedicalRAG - ERROR - OpenAI API/Connection error (APIStatusError): Error code: 413 - {'error': {'code': 'tokens_limit_reached', 'message': 'Request body too large for gpt-4o model. Max size: 8000 tokens.', 'details': 'Request body too large for gpt-4o model. Max size: 8000 tokens.'}} +2025-10-25 12:44:31,421 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 12:44:33,221 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 12:44:33,315 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 12:44:33,315 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 12:44:33,315 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 12:44:44,185 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 12:44:44,476 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 12:44:44,486 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 12:44:44,486 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 12:44:44,644 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 12:44:44,645 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 12:44:44,784 - AgenticMedicalRAG - INFO - Hybrid search returned 23 unique documents (query expansion: True) +2025-10-25 12:44:44,796 - AgenticMedicalRAG - INFO - Enriched 8 documents with surrounding context pages +2025-10-25 12:44:44,796 - AgenticMedicalRAG - INFO - Retrieved 23 documents, added 32 context pages +2025-10-25 12:51:00,628 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 12:51:01,107 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 12:51:41,172 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 12:51:41,644 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 12:52:36,516 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 12:52:37,099 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 12:52:37,184 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 12:52:37,184 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 12:52:37,185 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 12:52:42,652 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 12:52:42,702 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 12:52:42,711 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 12:52:42,712 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 12:52:42,866 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 12:52:42,866 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 12:52:43,005 - AgenticMedicalRAG - INFO - Hybrid search returned 23 unique documents (query expansion: True) +2025-10-25 12:52:43,019 - AgenticMedicalRAG - INFO - Enriched 8 documents with surrounding context pages +2025-10-25 12:52:43,019 - AgenticMedicalRAG - INFO - Retrieved 23 documents, added 32 context pages +2025-10-25 12:53:21,568 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 12:53:22,040 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 12:53:22,126 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 12:53:22,126 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 12:53:22,126 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 12:53:27,491 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 12:53:27,534 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 12:53:27,548 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 12:53:27,548 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 12:53:27,705 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 12:53:27,705 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 12:53:27,856 - AgenticMedicalRAG - INFO - Hybrid search returned 23 unique documents (query expansion: True) +2025-10-25 12:53:27,873 - AgenticMedicalRAG - INFO - Enriched 8 documents with surrounding context pages +2025-10-25 12:53:27,874 - AgenticMedicalRAG - INFO - Retrieved 23 documents, added 32 context pages +2025-10-25 12:54:30,461 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 12:54:31,019 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 12:54:31,104 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 12:54:31,104 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 12:54:31,105 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 12:54:36,138 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 12:54:36,179 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 12:54:36,189 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 12:54:36,189 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 12:54:36,362 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 12:54:36,363 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 12:54:36,516 - AgenticMedicalRAG - INFO - Hybrid search returned 23 unique documents (query expansion: True) +2025-10-25 12:54:36,534 - AgenticMedicalRAG - INFO - Enriched 8 documents with surrounding context pages +2025-10-25 12:54:36,534 - AgenticMedicalRAG - INFO - Retrieved 23 documents, added 32 context pages +2025-10-25 13:22:03,869 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 13:22:04,809 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 13:22:04,873 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 13:22:04,874 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 13:22:04,875 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 13:22:12,865 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 13:22:12,987 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 13:22:13,001 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 13:22:13,001 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 13:22:13,397 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 13:22:13,398 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 13:22:14,173 - AgenticMedicalRAG - INFO - Hybrid search returned 23 unique documents (query expansion: True) +2025-10-25 13:22:14,196 - AgenticMedicalRAG - INFO - Enriched 8 documents with surrounding context pages +2025-10-25 13:22:14,197 - AgenticMedicalRAG - INFO - Retrieved 23 documents, added 32 context pages +2025-10-25 13:24:30,853 - AgenticMedicalRAG - INFO - Hybrid search returned 23 unique documents (query expansion: True) +2025-10-25 13:24:30,857 - AgenticMedicalRAG - INFO - Enriched 8 documents with surrounding context pages +2025-10-25 13:24:30,857 - AgenticMedicalRAG - INFO - Retrieved 23 documents, added 32 context pages +2025-10-25 16:36:57,334 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 16:36:57,857 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 16:36:57,946 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 16:36:57,946 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 16:36:57,946 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 16:37:03,254 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 16:37:03,300 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 16:37:03,308 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 16:37:03,316 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 16:37:03,478 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 16:37:03,478 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 16:37:03,618 - AgenticMedicalRAG - INFO - Hybrid search returned 23 unique documents (query expansion: True) +2025-10-25 16:37:03,635 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 16:37:03,635 - AgenticMedicalRAG - INFO - Retrieved 23 documents, added 10 context pages +2025-10-25 16:37:30,424 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 16:37:30,905 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 16:37:30,959 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 16:37:30,960 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 16:37:30,961 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 16:37:36,371 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 16:37:36,419 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 16:37:36,437 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 16:37:36,438 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 16:37:36,885 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 16:37:36,887 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 16:37:37,052 - AgenticMedicalRAG - INFO - Hybrid search returned 23 unique documents (query expansion: True) +2025-10-25 16:37:37,074 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 16:37:37,076 - AgenticMedicalRAG - INFO - Retrieved 23 documents, added 10 context pages +2025-10-25 16:41:41,522 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-10-25 16:41:41,522 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-10-25 16:41:41,627 - AgenticMedicalRAG - INFO - Hybrid search returned 14 unique documents (query expansion: True) +2025-10-25 16:41:41,629 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 16:41:41,630 - AgenticMedicalRAG - INFO - Retrieved 14 documents from NCCN +2025-10-25 16:41:41,631 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-10-25 16:41:41,731 - AgenticMedicalRAG - INFO - Hybrid search returned 5 unique documents (query expansion: True) +2025-10-25 16:41:41,785 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 16:41:41,786 - AgenticMedicalRAG - INFO - Retrieved 5 documents from ASCO +2025-10-25 16:41:41,786 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-10-25 16:41:41,896 - AgenticMedicalRAG - INFO - Hybrid search returned 4 unique documents (query expansion: True) +2025-10-25 16:41:41,946 - AgenticMedicalRAG - INFO - Enriched 4 documents with surrounding context pages +2025-10-25 16:41:41,947 - AgenticMedicalRAG - INFO - Retrieved 4 documents from ESMO +2025-10-25 16:41:41,948 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-10-25 16:41:42,057 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: True) +2025-10-25 16:41:42,057 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-10-25 16:41:42,173 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: True) +2025-10-25 16:41:42,194 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-10-25 16:41:42,195 - AgenticMedicalRAG - INFO - Retrieved 1 documents from Manus +2025-10-25 16:56:17,418 - AgenticMedicalRAG - INFO - Hybrid search returned 23 unique documents (query expansion: True) +2025-10-25 16:56:17,420 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 16:56:17,420 - AgenticMedicalRAG - INFO - Retrieved 23 documents, added 10 context pages +2025-10-25 16:58:46,397 - AgenticMedicalRAG - INFO - Hybrid search returned 23 unique documents (query expansion: True) +2025-10-25 16:58:46,399 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 16:58:46,400 - AgenticMedicalRAG - INFO - Retrieved 23 documents, added 10 context pages +2025-10-25 17:02:01,578 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-10-25 17:02:01,579 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-10-25 17:02:01,688 - AgenticMedicalRAG - INFO - Hybrid search returned 14 unique documents (query expansion: True) +2025-10-25 17:02:01,691 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 17:02:01,691 - AgenticMedicalRAG - INFO - Retrieved 14 documents from NCCN +2025-10-25 17:02:01,691 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-10-25 17:02:01,858 - AgenticMedicalRAG - INFO - Hybrid search returned 5 unique documents (query expansion: True) +2025-10-25 17:02:01,859 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 17:02:01,860 - AgenticMedicalRAG - INFO - Retrieved 5 documents from ASCO +2025-10-25 17:02:01,861 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-10-25 17:02:01,966 - AgenticMedicalRAG - INFO - Hybrid search returned 4 unique documents (query expansion: True) +2025-10-25 17:02:01,967 - AgenticMedicalRAG - INFO - Enriched 4 documents with surrounding context pages +2025-10-25 17:02:01,968 - AgenticMedicalRAG - INFO - Retrieved 4 documents from ESMO +2025-10-25 17:02:01,969 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-10-25 17:02:02,074 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: True) +2025-10-25 17:02:02,075 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-10-25 17:02:02,180 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: True) +2025-10-25 17:02:02,181 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-10-25 17:02:02,181 - AgenticMedicalRAG - INFO - Retrieved 1 documents from Manus +2025-10-25 17:04:23,237 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-10-25 17:04:23,238 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-10-25 17:04:23,335 - AgenticMedicalRAG - INFO - Hybrid search returned 14 unique documents (query expansion: True) +2025-10-25 17:04:23,337 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 17:04:23,338 - AgenticMedicalRAG - INFO - Retrieved 14 documents from NCCN +2025-10-25 17:04:23,338 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-10-25 17:04:23,442 - AgenticMedicalRAG - INFO - Hybrid search returned 5 unique documents (query expansion: True) +2025-10-25 17:04:23,443 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 17:04:23,443 - AgenticMedicalRAG - INFO - Retrieved 5 documents from ASCO +2025-10-25 17:04:23,444 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-10-25 17:04:23,553 - AgenticMedicalRAG - INFO - Hybrid search returned 4 unique documents (query expansion: True) +2025-10-25 17:04:23,554 - AgenticMedicalRAG - INFO - Enriched 4 documents with surrounding context pages +2025-10-25 17:04:23,555 - AgenticMedicalRAG - INFO - Retrieved 4 documents from ESMO +2025-10-25 17:04:23,555 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-10-25 17:04:23,663 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: True) +2025-10-25 17:04:23,664 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-10-25 17:04:23,766 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: True) +2025-10-25 17:04:23,766 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-10-25 17:04:23,767 - AgenticMedicalRAG - INFO - Retrieved 1 documents from Manus +2025-10-25 17:05:30,094 - AgenticMedicalRAG - INFO - Hybrid search returned 23 unique documents (query expansion: True) +2025-10-25 17:05:30,096 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 17:05:30,097 - AgenticMedicalRAG - INFO - Retrieved 23 documents, added 10 context pages +2025-10-25 17:08:12,864 - AgenticMedicalRAG - INFO - Hybrid search returned 23 unique documents (query expansion: True) +2025-10-25 17:08:12,866 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 17:08:12,867 - AgenticMedicalRAG - INFO - Retrieved 23 documents, added 10 context pages +2025-10-25 17:08:22,647 - AgenticMedicalRAG - INFO - Hybrid search returned 23 unique documents (query expansion: True) +2025-10-25 17:08:22,650 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 17:08:22,650 - AgenticMedicalRAG - INFO - Retrieved 23 documents, added 10 context pages +2025-10-25 17:09:20,206 - AgenticMedicalRAG - INFO - Hybrid search returned 23 unique documents (query expansion: True) +2025-10-25 17:09:20,208 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 17:09:20,209 - AgenticMedicalRAG - INFO - Retrieved 23 documents, added 10 context pages +2025-10-25 17:10:09,560 - AgenticMedicalRAG - INFO - Hybrid search returned 23 unique documents (query expansion: True) +2025-10-25 17:10:09,562 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 17:10:09,563 - AgenticMedicalRAG - INFO - Retrieved 23 documents, added 10 context pages +2025-10-25 17:23:28,207 - AgenticMedicalRAG - INFO - Hybrid search returned 23 unique documents (query expansion: True) +2025-10-25 17:23:28,208 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 17:23:28,209 - AgenticMedicalRAG - INFO - Retrieved 23 documents, added 10 context pages +2025-10-25 17:23:55,720 - AgenticMedicalRAG - INFO - Hybrid search returned 24 unique documents (query expansion: True) +2025-10-25 17:23:55,722 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 17:23:55,722 - AgenticMedicalRAG - INFO - Retrieved 24 documents, added 10 context pages +2025-10-25 17:24:40,902 - AgenticMedicalRAG - INFO - Hybrid search returned 24 unique documents (query expansion: True) +2025-10-25 17:24:40,904 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 17:24:40,905 - AgenticMedicalRAG - INFO - Retrieved 24 documents, added 10 context pages +2025-10-25 17:25:19,083 - AgenticMedicalRAG - INFO - Hybrid search returned 24 unique documents (query expansion: True) +2025-10-25 17:25:19,084 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 17:25:19,085 - AgenticMedicalRAG - INFO - Retrieved 24 documents, added 10 context pages +2025-10-25 17:26:40,729 - AgenticMedicalRAG - INFO - Hybrid search returned 24 unique documents (query expansion: True) +2025-10-25 17:26:40,731 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 17:26:40,731 - AgenticMedicalRAG - INFO - Retrieved 24 documents, added 10 context pages +2025-10-25 17:33:52,274 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 17:33:52,716 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 17:33:52,765 - AgenticMedicalRAG - INFO - Querying specific provider: NCCN +2025-10-25 17:33:52,766 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 17:33:52,767 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 17:33:52,768 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 17:33:58,664 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 17:33:58,709 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 17:33:58,721 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 17:33:58,722 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 17:33:59,124 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 17:33:59,125 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 17:33:59,237 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: False) +2025-10-25 17:33:59,238 - AgenticMedicalRAG - INFO - Enriched 0 documents with surrounding context pages +2025-10-25 17:33:59,239 - AgenticMedicalRAG - INFO - Retrieved 2 documents, added 0 context pages +2025-10-25 17:37:30,033 - AgenticMedicalRAG - INFO - Querying specific provider: NCCN +2025-10-25 17:37:30,090 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: False) +2025-10-25 17:37:30,091 - AgenticMedicalRAG - INFO - Enriched 0 documents with surrounding context pages +2025-10-25 17:37:30,091 - AgenticMedicalRAG - INFO - Retrieved 2 documents, added 0 context pages +2025-10-25 17:38:16,913 - AgenticMedicalRAG - INFO - Querying specific provider: NCCN +2025-10-25 17:38:16,965 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: False) +2025-10-25 17:38:16,966 - AgenticMedicalRAG - INFO - Enriched 0 documents with surrounding context pages +2025-10-25 17:38:16,966 - AgenticMedicalRAG - INFO - Retrieved 2 documents, added 0 context pages +2025-10-25 17:38:30,363 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 17:38:30,843 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 17:38:30,896 - AgenticMedicalRAG - INFO - Querying specific provider: NCCN +2025-10-25 17:38:30,897 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 17:38:30,897 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 17:38:30,898 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 17:38:36,264 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 17:38:36,311 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 17:38:36,321 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 17:38:36,322 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 17:38:36,719 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 17:38:36,719 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 17:38:36,850 - AgenticMedicalRAG - INFO - Hybrid search returned 4 unique documents (query expansion: False) +2025-10-25 17:38:36,851 - AgenticMedicalRAG - INFO - Enriched 0 documents with surrounding context pages +2025-10-25 17:38:36,852 - AgenticMedicalRAG - INFO - Retrieved 4 documents, added 0 context pages +2025-10-25 17:39:44,189 - AgenticMedicalRAG - INFO - Querying specific provider: NCCN +2025-10-25 17:39:44,243 - AgenticMedicalRAG - INFO - Hybrid search returned 4 unique documents (query expansion: False) +2025-10-25 17:39:44,244 - AgenticMedicalRAG - INFO - Enriched 0 documents with surrounding context pages +2025-10-25 17:39:44,245 - AgenticMedicalRAG - INFO - Retrieved 4 documents, added 0 context pages +2025-10-25 17:39:55,387 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 17:39:55,834 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 17:39:55,886 - AgenticMedicalRAG - INFO - Querying specific provider: NCCN +2025-10-25 17:39:55,887 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 17:39:55,887 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 17:39:55,889 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 17:40:01,196 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 17:40:01,242 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 17:40:01,253 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 17:40:01,254 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 17:40:01,668 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 17:40:01,669 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 17:40:01,799 - AgenticMedicalRAG - INFO - Hybrid search returned 9 unique documents (query expansion: False) +2025-10-25 17:40:01,818 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 17:40:01,819 - AgenticMedicalRAG - INFO - Retrieved 9 documents, added 10 context pages +2025-10-25 17:42:26,086 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-10-25 17:42:26,086 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-10-25 17:42:26,144 - AgenticMedicalRAG - INFO - Hybrid search returned 9 unique documents (query expansion: False) +2025-10-25 17:42:26,146 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 17:42:26,147 - AgenticMedicalRAG - INFO - Retrieved 9 documents from NCCN +2025-10-25 17:42:26,147 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-10-25 17:42:26,202 - AgenticMedicalRAG - INFO - Hybrid search returned 6 unique documents (query expansion: False) +2025-10-25 17:42:26,258 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 17:42:26,259 - AgenticMedicalRAG - INFO - Retrieved 6 documents from ASCO +2025-10-25 17:42:26,259 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-10-25 17:42:26,319 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: False) +2025-10-25 17:42:26,351 - AgenticMedicalRAG - INFO - Enriched 2 documents with surrounding context pages +2025-10-25 17:42:26,352 - AgenticMedicalRAG - INFO - Retrieved 2 documents from ESMO +2025-10-25 17:42:26,353 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-10-25 17:42:26,407 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-10-25 17:42:26,408 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-10-25 17:42:26,463 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-10-25 17:42:26,482 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-10-25 17:42:26,483 - AgenticMedicalRAG - INFO - Retrieved 1 documents from Manus +2025-10-25 17:42:37,247 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 17:42:37,687 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 17:42:37,737 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-10-25 17:42:37,738 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-10-25 17:42:37,738 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 17:42:37,739 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 17:42:37,740 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 17:42:43,437 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 17:42:43,479 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 17:42:43,489 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 17:42:43,491 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 17:42:43,886 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 17:42:43,887 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 17:42:43,997 - AgenticMedicalRAG - INFO - Hybrid search returned 9 unique documents (query expansion: False) +2025-10-25 17:42:44,017 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 17:42:44,018 - AgenticMedicalRAG - INFO - Retrieved 9 documents from NCCN +2025-10-25 17:42:44,019 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-10-25 17:42:44,077 - AgenticMedicalRAG - INFO - Hybrid search returned 6 unique documents (query expansion: False) +2025-10-25 17:42:44,119 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 17:42:44,120 - AgenticMedicalRAG - INFO - Retrieved 6 documents from ASCO +2025-10-25 17:42:44,121 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-10-25 17:42:44,174 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: False) +2025-10-25 17:42:44,201 - AgenticMedicalRAG - INFO - Enriched 2 documents with surrounding context pages +2025-10-25 17:42:44,202 - AgenticMedicalRAG - INFO - Retrieved 2 documents from ESMO +2025-10-25 17:42:44,203 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-10-25 17:42:44,256 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-10-25 17:42:44,256 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-10-25 17:42:44,319 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-10-25 17:42:44,336 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-10-25 17:42:44,337 - AgenticMedicalRAG - INFO - Retrieved 1 documents from Manus +2025-10-25 17:45:41,744 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 17:45:42,200 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 17:45:42,250 - AgenticMedicalRAG - INFO - Querying specific provider: Manus +2025-10-25 17:45:42,251 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 17:45:42,251 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 17:45:42,252 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 17:45:47,692 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 17:45:47,734 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 17:45:47,745 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 17:45:47,746 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 17:45:48,131 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 17:45:48,132 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 17:45:48,240 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-10-25 17:45:48,257 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-10-25 17:45:48,258 - AgenticMedicalRAG - INFO - Retrieved 1 documents, added 0 context pages +2025-10-25 17:48:26,852 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 17:48:27,298 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 17:48:27,350 - AgenticMedicalRAG - INFO - Querying specific provider: Manus +2025-10-25 17:48:27,351 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 17:48:27,352 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 17:48:27,353 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 17:48:32,835 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 17:48:32,880 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 17:48:32,889 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 17:48:32,890 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 17:48:33,295 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 17:48:33,296 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 17:48:33,405 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-10-25 17:48:33,426 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-10-25 17:48:33,427 - AgenticMedicalRAG - INFO - Retrieved 1 documents, added 0 context pages +2025-10-25 18:01:29,127 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 18:01:29,736 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 18:01:29,823 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-10-25 18:01:29,825 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-10-25 18:01:29,826 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 18:01:29,826 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 18:01:29,828 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 18:01:35,788 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 18:01:35,828 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 18:01:35,837 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 18:01:35,837 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 18:01:36,226 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 18:01:36,227 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 18:01:36,338 - AgenticMedicalRAG - INFO - Hybrid search returned 9 unique documents (query expansion: False) +2025-10-25 18:01:36,356 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 18:01:36,357 - AgenticMedicalRAG - INFO - Retrieved 9 documents from NCCN +2025-10-25 18:01:36,357 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-10-25 18:01:36,415 - AgenticMedicalRAG - INFO - Hybrid search returned 6 unique documents (query expansion: False) +2025-10-25 18:01:36,456 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 18:01:36,457 - AgenticMedicalRAG - INFO - Retrieved 6 documents from ASCO +2025-10-25 18:01:36,458 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-10-25 18:01:36,507 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: False) +2025-10-25 18:01:36,539 - AgenticMedicalRAG - INFO - Enriched 2 documents with surrounding context pages +2025-10-25 18:01:36,540 - AgenticMedicalRAG - INFO - Retrieved 2 documents from ESMO +2025-10-25 18:01:36,541 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-10-25 18:01:36,592 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-10-25 18:01:36,593 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-10-25 18:01:36,643 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-10-25 18:01:36,657 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-10-25 18:01:36,659 - AgenticMedicalRAG - INFO - Retrieved 1 documents from Manus +2025-10-25 18:20:11,686 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 18:20:12,152 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 18:20:12,205 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-10-25 18:20:12,206 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-10-25 18:20:12,207 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 18:20:12,207 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 18:20:12,208 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 18:20:17,692 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 18:20:17,743 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 18:20:17,756 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 18:20:17,757 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 18:20:18,169 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 18:20:18,170 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 18:20:18,278 - AgenticMedicalRAG - INFO - Hybrid search returned 9 unique documents (query expansion: False) +2025-10-25 18:20:18,300 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 18:20:18,302 - AgenticMedicalRAG - INFO - Retrieved 9 documents from NCCN +2025-10-25 18:20:18,302 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-10-25 18:20:18,355 - AgenticMedicalRAG - INFO - Hybrid search returned 6 unique documents (query expansion: False) +2025-10-25 18:20:18,410 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 18:20:18,411 - AgenticMedicalRAG - INFO - Retrieved 6 documents from ASCO +2025-10-25 18:20:18,411 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-10-25 18:20:18,466 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: False) +2025-10-25 18:20:18,497 - AgenticMedicalRAG - INFO - Enriched 2 documents with surrounding context pages +2025-10-25 18:20:18,498 - AgenticMedicalRAG - INFO - Retrieved 2 documents from ESMO +2025-10-25 18:20:18,498 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-10-25 18:20:18,552 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-10-25 18:20:18,553 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-10-25 18:20:18,609 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-10-25 18:20:18,623 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-10-25 18:20:18,624 - AgenticMedicalRAG - INFO - Retrieved 1 documents from Manus +2025-10-25 18:21:44,235 - AgenticMedicalRAG - INFO - Querying specific provider: ASCO +2025-10-25 18:21:44,284 - AgenticMedicalRAG - INFO - Hybrid search returned 6 unique documents (query expansion: False) +2025-10-25 18:21:44,286 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 18:21:44,286 - AgenticMedicalRAG - INFO - Retrieved 6 documents, added 8 context pages +2025-10-25 18:21:55,284 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 18:21:55,736 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 18:21:55,788 - AgenticMedicalRAG - INFO - Querying specific provider: ASCO +2025-10-25 18:21:55,789 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 18:21:55,790 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 18:21:55,790 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 18:22:01,175 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 18:22:01,217 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 18:22:01,226 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 18:22:01,227 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 18:22:01,624 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 18:22:01,625 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 18:22:01,734 - AgenticMedicalRAG - INFO - Hybrid search returned 6 unique documents (query expansion: False) +2025-10-25 18:22:01,775 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 18:22:01,776 - AgenticMedicalRAG - INFO - Retrieved 6 documents, added 8 context pages +2025-10-25 18:22:50,103 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 18:22:50,612 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 18:22:50,935 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 18:22:50,936 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 18:22:50,936 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 18:22:50,936 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 18:23:05,540 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 18:23:06,027 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 18:23:06,200 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 18:23:06,200 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 18:23:06,200 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 18:23:06,201 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 18:23:10,944 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 18:23:10,945 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-25 18:23:10,945 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-25 18:23:10,945 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 18:23:10,945 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 18:23:10,992 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 18:23:11,003 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 18:23:11,003 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 18:23:11,173 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 18:23:11,173 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 18:23:11,174 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-25 18:23:11,174 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-25 18:23:13,524 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-25 18:23:13,524 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-25 18:23:13,524 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-25 18:23:13,525 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-25 18:23:14,253 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-25 18:23:14,253 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-25 18:23:14,254 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-25 18:24:29,303 - AgenticMedicalRAG - CRITICAL - Critical error in safe_run_agent_streaming: cannot import name 'store_user_question' from 'core.tools' (d:\Work\API\core\tools.py) +2025-10-25 18:24:29,304 - AgenticMedicalRAG - CRITICAL - Traceback: Traceback (most recent call last): + File "d:\Work\API\core\agent.py", line 688, in safe_run_agent_streaming + async for chunk in run_agent_streaming(user_input, session_id): + yield chunk + File "d:\Work\API\core\agent.py", line 434, in run_agent_streaming + from .tools import store_user_question +ImportError: cannot import name 'store_user_question' from 'core.tools' (d:\Work\API\core\tools.py) + +2025-10-25 18:24:42,085 - AgenticMedicalRAG - CRITICAL - Critical error in safe_run_agent_streaming: cannot import name 'store_user_question' from 'core.tools' (d:\Work\API\core\tools.py) +2025-10-25 18:24:42,086 - AgenticMedicalRAG - CRITICAL - Traceback: Traceback (most recent call last): + File "d:\Work\API\core\agent.py", line 688, in safe_run_agent_streaming + async for chunk in run_agent_streaming(user_input, session_id): + yield chunk + File "d:\Work\API\core\agent.py", line 434, in run_agent_streaming + from .tools import store_user_question +ImportError: cannot import name 'store_user_question' from 'core.tools' (d:\Work\API\core\tools.py) + +2025-10-25 18:26:49,273 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 18:26:49,812 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 18:26:49,997 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 18:26:49,998 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 18:26:49,998 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 18:26:49,998 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 18:26:55,335 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 18:26:55,335 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-25 18:26:55,335 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-25 18:26:55,336 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 18:26:55,336 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 18:26:55,379 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 18:26:55,396 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 18:26:55,396 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 18:26:55,583 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 18:26:55,583 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 18:26:55,584 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-25 18:26:55,584 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-25 18:26:58,073 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-25 18:26:58,073 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-25 18:26:58,073 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-25 18:26:58,073 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-25 18:26:58,676 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-25 18:26:58,676 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-25 18:26:58,676 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-25 20:26:38,875 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 20:26:39,927 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 20:26:40,282 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 20:26:40,283 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 20:26:40,283 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 20:26:40,284 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 20:26:49,404 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 20:26:49,405 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-25 20:26:49,405 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-25 20:26:49,405 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 20:26:49,406 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 20:26:49,488 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 20:26:49,510 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 20:26:49,510 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 20:26:49,850 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 20:26:49,851 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 20:26:49,851 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-25 20:26:49,852 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-25 20:26:54,804 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-25 20:26:54,805 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-25 20:26:54,805 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-25 20:26:54,805 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-25 20:26:56,153 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-25 20:26:56,154 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-25 20:26:56,154 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-25 21:58:49,593 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): What is the recommended treatment for stage III no... +2025-10-25 21:58:52,270 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-10-25 21:58:52,271 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-10-25 21:58:53,076 - AgenticMedicalRAG - INFO - Hybrid search returned 10 unique documents (query expansion: False) +2025-10-25 21:58:53,101 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 21:58:53,101 - AgenticMedicalRAG - INFO - Retrieved 10 documents from NCCN +2025-10-25 21:58:53,101 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-10-25 21:58:53,161 - AgenticMedicalRAG - INFO - Hybrid search returned 6 unique documents (query expansion: False) +2025-10-25 21:58:53,219 - AgenticMedicalRAG - INFO - Enriched 4 documents with surrounding context pages +2025-10-25 21:58:53,219 - AgenticMedicalRAG - INFO - Retrieved 6 documents from ASCO +2025-10-25 21:58:53,219 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-10-25 21:58:53,274 - AgenticMedicalRAG - INFO - Hybrid search returned 5 unique documents (query expansion: False) +2025-10-25 21:58:53,331 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 21:58:53,331 - AgenticMedicalRAG - INFO - Retrieved 5 documents from ESMO +2025-10-25 21:58:53,331 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-10-25 21:58:53,387 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-10-25 21:58:53,388 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-10-25 21:58:53,443 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-10-25 21:58:53,462 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-10-25 21:58:53,462 - AgenticMedicalRAG - INFO - Retrieved 1 documents from Manus +2025-10-25 21:58:54,127 - AgenticMedicalRAG - ERROR - OpenAI API/Connection error (APIStatusError): Error code: 413 - {'error': {'code': 'tokens_limit_reached', 'message': 'Request body too large for gpt-4o model. Max size: 8000 tokens.', 'details': 'Request body too large for gpt-4o model. Max size: 8000 tokens.'}} +2025-10-25 21:58:54,127 - AgenticMedicalRAG - INFO - Retrying after 2 seconds... (Attempt 1/3) +2025-10-25 21:58:56,128 - AgenticMedicalRAG - INFO - Processing user input (attempt 2): What is the recommended treatment for stage III no... +2025-10-25 21:58:56,991 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-10-25 21:58:56,991 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-10-25 21:58:57,070 - AgenticMedicalRAG - INFO - Hybrid search returned 10 unique documents (query expansion: False) +2025-10-25 21:58:57,072 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 21:58:57,073 - AgenticMedicalRAG - INFO - Retrieved 10 documents from NCCN +2025-10-25 21:58:57,073 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-10-25 21:58:57,160 - AgenticMedicalRAG - INFO - Hybrid search returned 6 unique documents (query expansion: False) +2025-10-25 21:58:57,161 - AgenticMedicalRAG - INFO - Enriched 4 documents with surrounding context pages +2025-10-25 21:58:57,161 - AgenticMedicalRAG - INFO - Retrieved 6 documents from ASCO +2025-10-25 21:58:57,161 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-10-25 21:58:57,246 - AgenticMedicalRAG - INFO - Hybrid search returned 5 unique documents (query expansion: False) +2025-10-25 21:58:57,247 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 21:58:57,248 - AgenticMedicalRAG - INFO - Retrieved 5 documents from ESMO +2025-10-25 21:58:57,248 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-10-25 21:58:57,331 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-10-25 21:58:57,331 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-10-25 21:58:57,416 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-10-25 21:58:57,417 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-10-25 21:58:57,417 - AgenticMedicalRAG - INFO - Retrieved 1 documents from Manus +2025-10-25 21:58:57,799 - AgenticMedicalRAG - ERROR - OpenAI API/Connection error (APIStatusError): Error code: 413 - {'error': {'code': 'tokens_limit_reached', 'message': 'Request body too large for gpt-4o model. Max size: 8000 tokens.', 'details': 'Request body too large for gpt-4o model. Max size: 8000 tokens.'}} +2025-10-25 21:58:57,799 - AgenticMedicalRAG - INFO - Retrying after 4 seconds... (Attempt 2/3) +2025-10-25 21:59:01,800 - AgenticMedicalRAG - INFO - Processing user input (attempt 3): What is the recommended treatment for stage III no... +2025-10-25 21:59:33,422 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 21:59:34,464 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 21:59:34,842 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 21:59:34,843 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 21:59:34,844 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 21:59:34,844 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 21:59:45,290 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 21:59:45,290 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-25 21:59:45,290 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-25 21:59:45,291 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 21:59:45,291 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 21:59:45,372 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 21:59:45,396 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 21:59:45,396 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 21:59:45,821 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 21:59:45,821 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 21:59:45,821 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-25 21:59:45,822 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-25 21:59:50,870 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-25 21:59:50,871 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-25 21:59:50,871 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-25 21:59:50,871 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-25 21:59:52,408 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-25 21:59:52,409 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-25 21:59:52,409 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-25 22:01:08,289 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): What is the recommended treatment for stage III no... +2025-10-25 22:01:10,462 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-10-25 22:01:10,463 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-10-25 22:01:10,605 - AgenticMedicalRAG - INFO - Hybrid search returned 5 unique documents (query expansion: False) +2025-10-25 22:01:10,624 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 22:01:10,625 - AgenticMedicalRAG - INFO - Retrieved 5 documents from NCCN +2025-10-25 22:01:10,625 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-10-25 22:01:10,676 - AgenticMedicalRAG - INFO - Hybrid search returned 4 unique documents (query expansion: False) +2025-10-25 22:01:10,707 - AgenticMedicalRAG - INFO - Enriched 3 documents with surrounding context pages +2025-10-25 22:01:10,707 - AgenticMedicalRAG - INFO - Retrieved 4 documents from ASCO +2025-10-25 22:01:10,707 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-10-25 22:01:10,754 - AgenticMedicalRAG - INFO - Hybrid search returned 4 unique documents (query expansion: False) +2025-10-25 22:01:10,800 - AgenticMedicalRAG - INFO - Enriched 4 documents with surrounding context pages +2025-10-25 22:01:10,801 - AgenticMedicalRAG - INFO - Retrieved 4 documents from ESMO +2025-10-25 22:01:10,801 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-10-25 22:01:10,846 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-10-25 22:01:10,846 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-10-25 22:01:10,894 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-10-25 22:01:10,908 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-10-25 22:01:10,909 - AgenticMedicalRAG - INFO - Retrieved 1 documents from Manus +2025-10-25 22:01:11,433 - AgenticMedicalRAG - ERROR - OpenAI API/Connection error (APIStatusError): Error code: 413 - {'error': {'code': 'tokens_limit_reached', 'message': 'Request body too large for gpt-4o model. Max size: 8000 tokens.', 'details': 'Request body too large for gpt-4o model. Max size: 8000 tokens.'}} +2025-10-25 22:01:11,434 - AgenticMedicalRAG - INFO - Retrying after 2 seconds... (Attempt 1/3) +2025-10-25 22:01:13,434 - AgenticMedicalRAG - INFO - Processing user input (attempt 2): What is the recommended treatment for stage III no... +2025-10-25 22:01:14,568 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-10-25 22:01:14,568 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-10-25 22:01:14,625 - AgenticMedicalRAG - INFO - Hybrid search returned 5 unique documents (query expansion: False) +2025-10-25 22:01:14,626 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 22:01:14,627 - AgenticMedicalRAG - INFO - Retrieved 5 documents from NCCN +2025-10-25 22:01:14,627 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-10-25 22:01:14,682 - AgenticMedicalRAG - INFO - Hybrid search returned 4 unique documents (query expansion: False) +2025-10-25 22:01:14,683 - AgenticMedicalRAG - INFO - Enriched 3 documents with surrounding context pages +2025-10-25 22:01:14,683 - AgenticMedicalRAG - INFO - Retrieved 4 documents from ASCO +2025-10-25 22:01:14,683 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-10-25 22:01:14,737 - AgenticMedicalRAG - INFO - Hybrid search returned 4 unique documents (query expansion: False) +2025-10-25 22:01:14,737 - AgenticMedicalRAG - INFO - Enriched 4 documents with surrounding context pages +2025-10-25 22:01:14,738 - AgenticMedicalRAG - INFO - Retrieved 4 documents from ESMO +2025-10-25 22:01:14,738 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-10-25 22:01:14,787 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-10-25 22:01:14,787 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-10-25 22:01:14,841 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-10-25 22:01:14,841 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-10-25 22:01:14,841 - AgenticMedicalRAG - INFO - Retrieved 1 documents from Manus +2025-10-25 22:01:15,153 - AgenticMedicalRAG - ERROR - OpenAI API/Connection error (APIStatusError): Error code: 413 - {'error': {'code': 'tokens_limit_reached', 'message': 'Request body too large for gpt-4o model. Max size: 8000 tokens.', 'details': 'Request body too large for gpt-4o model. Max size: 8000 tokens.'}} +2025-10-25 22:01:15,154 - AgenticMedicalRAG - INFO - Retrying after 4 seconds... (Attempt 2/3) +2025-10-25 22:01:19,155 - AgenticMedicalRAG - INFO - Processing user input (attempt 3): What is the recommended treatment for stage III no... +2025-10-25 22:01:20,029 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-10-25 22:01:20,029 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-10-25 22:01:20,125 - AgenticMedicalRAG - INFO - Hybrid search returned 5 unique documents (query expansion: False) +2025-10-25 22:01:20,126 - AgenticMedicalRAG - INFO - Enriched 5 documents with surrounding context pages +2025-10-25 22:01:20,126 - AgenticMedicalRAG - INFO - Retrieved 5 documents from NCCN +2025-10-25 22:01:20,127 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-10-25 22:01:20,204 - AgenticMedicalRAG - INFO - Hybrid search returned 4 unique documents (query expansion: False) +2025-10-25 22:01:20,205 - AgenticMedicalRAG - INFO - Enriched 3 documents with surrounding context pages +2025-10-25 22:01:20,205 - AgenticMedicalRAG - INFO - Retrieved 4 documents from ASCO +2025-10-25 22:01:20,205 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-10-25 22:01:20,254 - AgenticMedicalRAG - INFO - Hybrid search returned 4 unique documents (query expansion: False) +2025-10-25 22:01:20,255 - AgenticMedicalRAG - INFO - Enriched 4 documents with surrounding context pages +2025-10-25 22:01:20,255 - AgenticMedicalRAG - INFO - Retrieved 4 documents from ESMO +2025-10-25 22:01:20,255 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-10-25 22:01:20,306 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-10-25 22:01:20,306 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-10-25 22:01:20,354 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-10-25 22:01:20,354 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-10-25 22:01:20,354 - AgenticMedicalRAG - INFO - Retrieved 1 documents from Manus +2025-10-25 22:01:20,937 - AgenticMedicalRAG - ERROR - OpenAI API/Connection error (APIStatusError): Error code: 413 - {'error': {'code': 'tokens_limit_reached', 'message': 'Request body too large for gpt-4o model. Max size: 8000 tokens.', 'details': 'Request body too large for gpt-4o model. Max size: 8000 tokens.'}} +2025-10-25 22:01:20,937 - AgenticMedicalRAG - INFO - Retrying after 8 seconds... (Attempt 3/3) +2025-10-25 22:02:36,561 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 22:02:40,195 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 22:02:40,549 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 22:02:40,550 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 22:02:40,551 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 22:02:40,551 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 22:02:56,488 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): What is the recommended treatment for stage III no... +2025-10-25 22:02:56,490 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-25 22:02:57,789 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-25 22:03:00,114 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-10-25 22:03:00,114 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-10-25 22:03:00,115 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 22:03:00,115 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 22:03:00,116 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 22:03:00,752 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 22:03:00,752 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-25 22:03:00,752 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-25 22:03:00,753 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 22:03:00,753 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 22:03:01,399 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 22:03:01,930 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 22:03:01,930 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 22:03:02,269 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 22:03:02,270 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 22:03:02,271 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-25 22:03:02,271 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-25 22:03:06,948 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-25 22:03:06,948 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-25 22:03:06,949 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-25 22:03:06,949 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-25 22:03:06,949 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-25 22:03:08,201 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 22:03:08,247 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 22:03:08,264 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 22:03:08,265 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 22:03:08,570 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 22:03:08,585 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 22:03:08,758 - AgenticMedicalRAG - INFO - Hybrid search returned 3 unique documents (query expansion: False) +2025-10-25 22:03:08,790 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-10-25 22:03:08,791 - AgenticMedicalRAG - INFO - Retrieved 3 documents from NCCN +2025-10-25 22:03:08,791 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-10-25 22:03:08,853 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: False) +2025-10-25 22:03:08,873 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-10-25 22:03:08,873 - AgenticMedicalRAG - INFO - Retrieved 2 documents from ASCO +2025-10-25 22:03:08,874 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-10-25 22:03:08,928 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: False) +2025-10-25 22:03:08,947 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-10-25 22:03:08,948 - AgenticMedicalRAG - INFO - Retrieved 2 documents from ESMO +2025-10-25 22:03:08,948 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-10-25 22:03:09,003 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-10-25 22:03:09,003 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-10-25 22:03:09,057 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-10-25 22:03:09,075 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-10-25 22:03:09,075 - AgenticMedicalRAG - INFO - Retrieved 1 documents from Manus +2025-10-25 22:05:10,315 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 22:05:11,073 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 22:05:11,299 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 22:05:11,300 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 22:05:11,300 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 22:05:11,300 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 22:05:18,847 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 22:05:18,848 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-25 22:05:18,848 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-25 22:05:18,848 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 22:05:18,849 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 22:05:18,938 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 22:05:18,957 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 22:05:18,957 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 22:05:19,282 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 22:05:19,283 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 22:05:19,283 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-25 22:05:19,284 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-25 22:05:23,373 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-25 22:05:23,373 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-25 22:05:23,373 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-25 22:05:23,374 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-25 22:05:24,766 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-25 22:05:24,767 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-25 22:05:24,768 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-25 22:05:37,163 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): What is the recommended treatment for stage III no... +2025-10-25 22:05:39,458 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-10-25 22:05:39,459 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-10-25 22:05:39,656 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: False) +2025-10-25 22:05:39,656 - AgenticMedicalRAG - INFO - Enriched 0 documents with surrounding context pages +2025-10-25 22:05:39,657 - AgenticMedicalRAG - INFO - Retrieved 2 documents from NCCN +2025-10-25 22:05:39,657 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-10-25 22:05:39,740 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-10-25 22:05:39,740 - AgenticMedicalRAG - INFO - Enriched 0 documents with surrounding context pages +2025-10-25 22:05:39,740 - AgenticMedicalRAG - INFO - Retrieved 1 documents from ASCO +2025-10-25 22:05:39,740 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-10-25 22:05:39,813 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-10-25 22:05:39,813 - AgenticMedicalRAG - INFO - Enriched 0 documents with surrounding context pages +2025-10-25 22:05:39,814 - AgenticMedicalRAG - INFO - Retrieved 1 documents from ESMO +2025-10-25 22:05:39,814 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-10-25 22:05:39,885 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-10-25 22:05:39,886 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-10-25 22:05:39,957 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-10-25 22:05:39,958 - AgenticMedicalRAG - INFO - Enriched 0 documents with surrounding context pages +2025-10-25 22:05:39,958 - AgenticMedicalRAG - INFO - Retrieved 1 documents from Manus +2025-10-25 22:05:46,890 - AgenticMedicalRAG - INFO - Performing background validation for streaming response... +2025-10-25 22:05:46,891 - AgenticMedicalRAG - ERROR - Background validation failed: cannot import name '_last_user_question' from 'core.tools' (d:\Work\API\core\tools.py) +2025-10-25 22:05:46,892 - AgenticMedicalRAG - INFO - Successfully processed user input: What is the recommended treatment for stage III no... +2025-10-25 22:10:37,361 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 22:10:37,993 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 22:10:38,222 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 22:10:38,223 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 22:10:38,223 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 22:10:38,224 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 22:10:47,653 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 22:10:48,318 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 22:10:48,531 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 22:10:48,532 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 22:10:48,532 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 22:10:48,532 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 22:10:55,105 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 22:10:55,106 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-25 22:10:55,106 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-25 22:10:55,106 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 22:10:55,106 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 22:10:55,195 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 22:10:55,217 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 22:10:55,218 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 22:10:55,548 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 22:10:55,549 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 22:10:55,549 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-25 22:10:55,549 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-25 22:10:59,429 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-25 22:10:59,430 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-25 22:10:59,430 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-25 22:10:59,430 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-25 22:11:00,220 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-25 22:11:00,221 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-25 22:11:00,221 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-25 22:11:13,893 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 22:11:14,532 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 22:11:14,752 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 22:11:14,753 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 22:11:14,753 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 22:11:14,754 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 22:11:24,588 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 22:11:25,216 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 22:11:25,436 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 22:11:25,437 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 22:11:25,438 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 22:11:25,438 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 22:11:40,553 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 22:11:41,233 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 22:11:41,446 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 22:11:41,447 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 22:11:41,447 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 22:11:41,448 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 22:11:47,673 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 22:11:47,674 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-25 22:11:47,674 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-25 22:11:47,674 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 22:11:47,675 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 22:11:47,728 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 22:11:47,740 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 22:11:47,740 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 22:11:47,930 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 22:11:47,931 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 22:11:47,931 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-25 22:11:47,931 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-25 22:11:51,285 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-25 22:11:51,286 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-25 22:11:51,286 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-25 22:11:51,286 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-25 22:11:52,106 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-25 22:11:52,107 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-25 22:11:52,107 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-25 22:15:22,459 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 22:15:23,180 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 22:15:23,416 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 22:15:23,416 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 22:15:23,417 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 22:15:23,417 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 22:15:29,674 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 22:15:29,674 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-25 22:15:29,674 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-25 22:15:29,675 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 22:15:29,675 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 22:15:29,767 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 22:15:29,791 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 22:15:29,792 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 22:15:30,094 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 22:15:30,095 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 22:15:30,095 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-25 22:15:30,095 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-25 22:15:33,381 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-25 22:15:33,382 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-25 22:15:33,382 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-25 22:15:33,382 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-25 22:15:34,151 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-25 22:15:34,151 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-25 22:15:34,151 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-25 22:16:06,852 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): What is the recommended treatment for stage III no... +2025-10-25 22:16:08,860 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-10-25 22:16:08,860 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-10-25 22:16:09,043 - AgenticMedicalRAG - INFO - Hybrid search returned 3 unique documents (query expansion: False) +2025-10-25 22:16:09,043 - AgenticMedicalRAG - INFO - Enriched 0 documents with surrounding context pages +2025-10-25 22:16:09,043 - AgenticMedicalRAG - INFO - Retrieved 3 documents from NCCN +2025-10-25 22:16:09,043 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-10-25 22:16:09,120 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: False) +2025-10-25 22:16:09,121 - AgenticMedicalRAG - INFO - Enriched 0 documents with surrounding context pages +2025-10-25 22:16:09,121 - AgenticMedicalRAG - INFO - Retrieved 2 documents from ASCO +2025-10-25 22:16:09,121 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-10-25 22:16:09,185 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: False) +2025-10-25 22:16:09,185 - AgenticMedicalRAG - INFO - Enriched 0 documents with surrounding context pages +2025-10-25 22:16:09,185 - AgenticMedicalRAG - INFO - Retrieved 2 documents from ESMO +2025-10-25 22:16:09,185 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-10-25 22:16:09,258 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-10-25 22:16:09,259 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-10-25 22:16:09,327 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-10-25 22:16:09,327 - AgenticMedicalRAG - INFO - Enriched 0 documents with surrounding context pages +2025-10-25 22:16:09,327 - AgenticMedicalRAG - INFO - Retrieved 1 documents from Manus +2025-10-25 22:16:16,421 - AgenticMedicalRAG - INFO - Performing background validation for streaming response... +2025-10-25 22:16:16,422 - AgenticMedicalRAG - ERROR - Background validation failed: cannot import name '_last_user_question' from 'core.tools' (d:\Work\API\core\tools.py) +2025-10-25 22:16:16,422 - AgenticMedicalRAG - INFO - Successfully processed user input: What is the recommended treatment for stage III no... +2025-10-25 22:21:26,903 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 22:21:28,005 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 22:21:28,392 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 22:21:28,394 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 22:21:28,395 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 22:21:28,395 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 22:21:37,301 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 22:21:37,301 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-25 22:21:37,301 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-25 22:21:37,301 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 22:21:37,301 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 22:21:37,392 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 22:21:37,414 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 22:21:37,415 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 22:21:37,831 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 22:21:37,831 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 22:21:37,831 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-25 22:21:37,832 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-25 22:21:43,835 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-25 22:21:43,836 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-25 22:21:43,836 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-25 22:21:43,837 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-25 22:21:45,365 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-25 22:21:45,365 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-25 22:21:45,365 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-25 22:22:14,039 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 22:22:15,158 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 22:22:15,547 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 22:22:15,548 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 22:22:15,548 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 22:22:15,549 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 22:22:24,794 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 22:22:24,795 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-25 22:22:24,795 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-25 22:22:24,795 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 22:22:24,795 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 22:22:24,887 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 22:22:24,911 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 22:22:24,911 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 22:22:25,325 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 22:22:25,325 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 22:22:25,325 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-25 22:22:25,326 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-25 22:22:31,602 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-25 22:22:31,602 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-25 22:22:31,602 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-25 22:22:31,603 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-25 22:22:45,890 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 22:22:47,097 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 22:22:47,484 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 22:22:47,485 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 22:22:47,485 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 22:22:47,486 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 22:22:59,810 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 22:22:59,811 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-25 22:22:59,811 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-25 22:22:59,811 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 22:22:59,812 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 22:22:59,881 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 22:22:59,906 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 22:22:59,906 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 22:23:00,276 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 22:23:00,277 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 22:23:00,277 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-25 22:23:00,278 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-25 22:23:04,500 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-25 22:23:04,500 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-25 22:23:04,500 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-25 22:23:04,501 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-25 22:23:05,340 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-25 22:23:05,340 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-25 22:23:05,340 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-25 22:23:27,332 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-25 22:23:28,498 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-25 22:23:28,878 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-25 22:23:28,879 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-25 22:23:28,880 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-25 22:23:28,880 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-25 22:23:37,241 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-25 22:23:37,241 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-25 22:23:37,242 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-25 22:23:37,242 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-25 22:23:37,242 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-25 22:23:37,324 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-25 22:23:37,350 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-25 22:23:37,350 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-25 22:23:37,730 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-25 22:23:37,730 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-25 22:23:37,731 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-25 22:23:37,731 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-25 22:23:42,852 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-25 22:23:42,853 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-25 22:23:42,854 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-25 22:23:42,854 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-25 22:23:44,251 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-25 22:23:44,251 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-25 22:23:44,251 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-25 22:26:31,996 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): What is the recommended treatment for stage III no... +2025-10-25 22:26:34,640 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-10-25 22:26:34,640 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-10-25 22:26:34,870 - AgenticMedicalRAG - INFO - Hybrid search returned 3 unique documents (query expansion: False) +2025-10-25 22:26:34,870 - AgenticMedicalRAG - INFO - Enriched 0 documents with surrounding context pages +2025-10-25 22:26:34,870 - AgenticMedicalRAG - INFO - Retrieved 3 documents from NCCN +2025-10-25 22:26:34,871 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-10-25 22:26:34,944 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: False) +2025-10-25 22:26:34,945 - AgenticMedicalRAG - INFO - Enriched 0 documents with surrounding context pages +2025-10-25 22:26:34,945 - AgenticMedicalRAG - INFO - Retrieved 2 documents from ASCO +2025-10-25 22:26:34,945 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-10-25 22:26:35,016 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: False) +2025-10-25 22:26:35,016 - AgenticMedicalRAG - INFO - Enriched 0 documents with surrounding context pages +2025-10-25 22:26:35,016 - AgenticMedicalRAG - INFO - Retrieved 2 documents from ESMO +2025-10-25 22:26:35,016 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-10-25 22:26:35,086 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-10-25 22:26:35,086 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-10-25 22:26:35,154 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-10-25 22:26:35,154 - AgenticMedicalRAG - INFO - Enriched 0 documents with surrounding context pages +2025-10-25 22:26:35,155 - AgenticMedicalRAG - INFO - Retrieved 1 documents from Manus +2025-10-25 22:26:43,388 - AgenticMedicalRAG - INFO - Performing background validation for streaming response... +2025-10-25 22:26:44,220 - AgenticMedicalRAG - INFO - Medical answer validator initialized successfully +2025-10-25 22:26:44,221 - AgenticMedicalRAG - INFO - GitHub token configured: ghp_KWH...dnCc +2025-10-25 22:26:44,221 - AgenticMedicalRAG - INFO - GitHub storage initialized for MoazEldsouky/cloud-data-store +2025-10-25 22:26:45,074 - AgenticMedicalRAG - INFO - Found 6 existing evaluations in GitHub +2025-10-25 22:26:45,075 - AgenticMedicalRAG - INFO - Next interaction ID will be: 7 +2025-10-25 22:26:45,075 - AgenticMedicalRAG - INFO - Starting validation for interaction 7 +2025-10-25 22:26:54,384 - AgenticMedicalRAG - INFO - Attempting to save evaluation with ID: 7 +2025-10-25 22:26:54,385 - AgenticMedicalRAG - INFO - GitHub storage instance obtained, calling save_validation_results... +2025-10-25 22:26:54,385 - AgenticMedicalRAG - INFO - Attempt 1/3: Loading existing evaluations from GitHub... +2025-10-25 22:26:55,232 - AgenticMedicalRAG - INFO - Successfully loaded 6 existing evaluations +2025-10-25 22:26:55,233 - AgenticMedicalRAG - INFO - Adding new evaluation with ID: 7 +2025-10-25 22:26:55,233 - AgenticMedicalRAG - INFO - Appended new evaluation. Total count: 7 +2025-10-25 22:26:56,046 - AgenticMedicalRAG - INFO - Uploading to GitHub: medical_data/evaluation_results.json (size: 473703 bytes) +2025-10-25 22:26:59,093 - AgenticMedicalRAG - INFO - ✓ Successfully uploaded medical_data/evaluation_results.json to GitHub +2025-10-25 22:26:59,095 - AgenticMedicalRAG - INFO - ✓ Successfully saved evaluation 7. Total evaluations now: 7 +2025-10-25 22:26:59,096 - AgenticMedicalRAG - INFO - ✓ Evaluation saved to GitHub successfully with ID: 7 +2025-10-25 22:26:59,096 - AgenticMedicalRAG - INFO - Background validation completed - Interaction ID: 7 +2025-10-25 22:26:59,096 - AgenticMedicalRAG - INFO - Validation scores - Overall: 90/100, Accuracy: 95/100, Coherence: 90/100, Relevance: 88/100 +2025-10-25 22:26:59,097 - AgenticMedicalRAG - INFO - Successfully processed user input: What is the recommended treatment for stage III no... +2025-10-26 11:36:19,414 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-26 11:36:22,633 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-26 11:36:23,215 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-26 11:36:23,216 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-26 11:36:23,217 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-26 11:36:23,217 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-26 11:36:40,149 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-26 11:36:40,150 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-26 11:36:40,150 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-26 11:36:40,150 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-26 11:36:40,150 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-26 11:36:40,553 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-26 11:36:40,576 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-26 11:36:40,576 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-26 11:36:40,942 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-26 11:36:40,943 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-26 11:36:40,943 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-26 11:36:40,943 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-26 11:36:45,411 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-26 11:36:45,412 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-26 11:36:45,412 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-26 11:36:45,412 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-26 11:36:46,741 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-26 11:36:46,741 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-26 11:36:46,741 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-26 11:44:38,232 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): hi... +2025-10-26 11:44:40,958 - AgenticMedicalRAG - WARNING - Rate limit exceeded. Retrying in 2 seconds... (Attempt 1/3) +2025-10-26 11:44:42,960 - AgenticMedicalRAG - INFO - Processing user input (attempt 2): hi... +2025-10-26 11:44:45,478 - AgenticMedicalRAG - WARNING - Rate limit exceeded. Retrying in 4 seconds... (Attempt 2/3) +2025-10-26 11:44:49,480 - AgenticMedicalRAG - INFO - Processing user input (attempt 3): hi... +2025-10-26 11:44:51,642 - AgenticMedicalRAG - WARNING - Rate limit exceeded. Retrying in 8 seconds... (Attempt 3/3) +2025-10-26 11:44:59,644 - AgenticMedicalRAG - INFO - Processing user input (attempt 4): hi... +2025-10-26 11:45:01,924 - AgenticMedicalRAG - WARNING - Rate limit exceeded. Retrying in 16 seconds... (Attempt 4/3) +2025-10-26 11:45:01,924 - AgenticMedicalRAG - ERROR - Rate limit exceeded after maximum retries +2025-10-26 11:49:10,637 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-10-26 11:49:11,296 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-10-26 11:49:11,571 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-10-26 11:49:11,572 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-10-26 11:49:11,572 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-10-26 11:49:11,572 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-10-26 11:49:17,924 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-10-26 11:49:17,924 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-10-26 11:49:17,925 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-10-26 11:49:17,925 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-10-26 11:49:17,925 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-10-26 11:49:18,003 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-10-26 11:49:18,020 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-10-26 11:49:18,021 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-10-26 11:49:18,321 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-10-26 11:49:18,321 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-10-26 11:49:18,322 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-10-26 11:49:18,322 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-10-26 11:49:21,905 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): hi... +2025-10-26 11:49:21,917 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-26 11:49:22,620 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-10-26 11:49:22,620 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-10-26 11:49:22,620 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-10-26 11:49:22,621 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-10-26 11:49:23,980 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-26 11:49:23,980 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-10-26 11:49:23,980 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-10-26 11:49:23,983 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-10-26 11:49:25,762 - AgenticMedicalRAG - INFO - Successfully processed user input: hi... +2025-10-26 11:49:25,762 - AgenticMedicalRAG - INFO - Performing background validation... +2025-10-26 11:49:25,762 - AgenticMedicalRAG - INFO - Skipping validation: insufficient context +2025-11-09 20:49:52,325 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-09 20:49:53,407 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-09 20:49:53,482 - AgenticMedicalRAG - INFO - Querying specific provider: ASCO +2025-11-09 20:49:53,483 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-09 20:49:53,484 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-09 20:49:53,492 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-09 20:50:02,504 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-09 20:50:02,696 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-09 20:50:02,748 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-09 20:50:02,750 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-09 20:50:03,544 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-09 20:50:03,546 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-09 20:50:04,329 - AgenticMedicalRAG - INFO - Hybrid search returned 5 unique documents (query expansion: False) +2025-11-09 20:50:04,359 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-09 20:50:04,361 - AgenticMedicalRAG - INFO - Retrieved 5 documents, added 1 context pages +2025-11-09 20:50:41,814 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-11-09 20:50:41,815 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-11-09 20:50:41,945 - AgenticMedicalRAG - INFO - Hybrid search returned 6 unique documents (query expansion: False) +2025-11-09 20:50:41,952 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-09 20:50:41,953 - AgenticMedicalRAG - INFO - Retrieved 6 documents from NCCN +2025-11-09 20:50:41,954 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-11-09 20:50:42,069 - AgenticMedicalRAG - INFO - Hybrid search returned 5 unique documents (query expansion: False) +2025-11-09 20:50:42,071 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-09 20:50:42,072 - AgenticMedicalRAG - INFO - Retrieved 5 documents from ASCO +2025-11-09 20:50:42,072 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-11-09 20:50:42,217 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: False) +2025-11-09 20:50:42,222 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-09 20:50:42,223 - AgenticMedicalRAG - INFO - Retrieved 2 documents from ESMO +2025-11-09 20:50:42,224 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-11-09 20:50:42,327 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-11-09 20:50:42,329 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-11-09 20:50:42,434 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-11-09 20:50:42,439 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-09 20:50:42,440 - AgenticMedicalRAG - INFO - Retrieved 1 documents from Manus +2025-11-10 10:34:36,281 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 10:34:39,861 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 10:34:40,420 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 10:34:40,421 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 10:34:40,422 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 10:34:40,422 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 10:35:00,656 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 10:35:00,657 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 10:35:00,657 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 10:35:00,658 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 10:35:00,658 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 10:35:01,135 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 10:35:01,196 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 10:35:01,197 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 10:35:01,569 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 10:35:01,569 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 10:35:01,569 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 10:35:01,570 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 10:35:06,419 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 10:35:06,420 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 10:35:06,420 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 10:35:06,420 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 10:35:07,949 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 10:35:07,950 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 10:35:07,950 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 10:35:57,681 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): Hi... +2025-11-10 10:35:59,325 - AgenticMedicalRAG - ERROR - OpenAI API error: Error code: 401 - {'error': {'code': 'unauthorized', 'message': 'Bad credentials', 'details': 'Bad credentials'}} +2025-11-10 10:36:01,326 - AgenticMedicalRAG - INFO - Processing user input (attempt 2): Hi... +2025-11-10 10:36:01,767 - AgenticMedicalRAG - ERROR - OpenAI API error: Error code: 401 - {'error': {'code': 'unauthorized', 'message': 'Bad credentials', 'details': 'Bad credentials'}} +2025-11-10 10:36:03,769 - AgenticMedicalRAG - INFO - Processing user input (attempt 3): Hi... +2025-11-10 10:36:04,224 - AgenticMedicalRAG - ERROR - OpenAI API error: Error code: 401 - {'error': {'code': 'unauthorized', 'message': 'Bad credentials', 'details': 'Bad credentials'}} +2025-11-10 10:36:06,225 - AgenticMedicalRAG - INFO - Processing user input (attempt 4): Hi... +2025-11-10 10:36:06,584 - AgenticMedicalRAG - ERROR - OpenAI API error: Error code: 401 - {'error': {'code': 'unauthorized', 'message': 'Bad credentials', 'details': 'Bad credentials'}} +2025-11-10 10:37:08,538 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 10:37:09,330 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 10:37:09,541 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 10:37:09,542 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 10:37:09,542 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 10:37:09,543 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 10:37:16,983 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 10:37:16,983 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 10:37:16,983 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 10:37:16,984 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 10:37:16,984 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 10:37:17,070 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 10:37:17,091 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 10:37:17,091 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 10:37:17,441 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 10:37:17,442 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 10:37:17,442 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 10:37:17,443 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 10:37:22,333 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 10:37:22,333 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 10:37:22,333 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 10:37:22,334 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 10:37:23,581 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 10:37:23,582 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 10:37:23,582 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 10:37:29,269 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): hi... +2025-11-10 10:37:31,593 - AgenticMedicalRAG - INFO - Performing background validation for streaming response... +2025-11-10 10:37:31,594 - AgenticMedicalRAG - INFO - Skipping validation: insufficient context +2025-11-10 10:37:31,594 - AgenticMedicalRAG - INFO - Successfully processed user input: hi... +2025-11-10 10:45:08,846 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): Hi, I'am moaz... +2025-11-10 10:45:11,106 - AgenticMedicalRAG - INFO - Performing background validation for streaming response... +2025-11-10 10:45:11,106 - AgenticMedicalRAG - INFO - Skipping validation: insufficient context +2025-11-10 10:45:11,106 - AgenticMedicalRAG - INFO - Successfully processed user input: Hi, I'am moaz... +2025-11-10 10:45:21,512 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): what is my name... +2025-11-10 10:45:23,691 - AgenticMedicalRAG - INFO - Performing background validation for streaming response... +2025-11-10 10:45:23,691 - AgenticMedicalRAG - INFO - Skipping validation: insufficient context +2025-11-10 10:45:23,692 - AgenticMedicalRAG - INFO - Successfully processed user input: what is my name... +2025-11-10 10:55:08,090 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 10:55:08,878 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 10:55:09,176 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 10:55:09,177 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 10:55:09,177 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 10:55:09,177 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 10:55:15,648 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 10:55:15,649 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 10:55:15,649 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 10:55:15,649 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 10:55:15,649 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 10:55:15,712 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 10:55:15,733 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 10:55:15,733 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 10:55:16,009 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 10:55:16,009 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 10:55:16,010 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 10:55:16,010 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 10:55:20,515 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 10:55:20,516 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 10:55:20,516 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 10:55:20,516 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 10:55:21,485 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 10:55:21,486 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 10:55:21,486 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 10:59:21,363 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): hi i am moaz... +2025-11-10 10:59:23,907 - AgenticMedicalRAG - INFO - Successfully processed user input: hi i am moaz... +2025-11-10 10:59:23,907 - AgenticMedicalRAG - INFO - Performing background validation... +2025-11-10 10:59:23,907 - AgenticMedicalRAG - INFO - Skipping validation: insufficient context +2025-11-10 11:10:12,190 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 11:10:12,771 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 11:10:12,954 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 11:10:12,955 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 11:10:12,955 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 11:10:12,956 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 11:10:23,354 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 11:10:23,354 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 11:10:23,355 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 11:10:23,355 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 11:10:23,355 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 11:10:23,425 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 11:10:23,443 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 11:10:23,443 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 11:10:23,711 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 11:10:23,711 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 11:10:23,711 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 11:10:23,712 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 11:10:27,718 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 11:10:27,718 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 11:10:27,718 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 11:10:27,718 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 11:10:28,736 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 11:10:28,736 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 11:10:28,736 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 11:16:14,507 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 11:16:15,058 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 11:16:15,243 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 11:16:15,244 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 11:16:15,244 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 11:16:15,245 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 11:16:22,692 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 11:16:22,693 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 11:16:22,693 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 11:16:22,693 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 11:16:22,693 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 11:16:22,786 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 11:16:22,807 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 11:16:22,808 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 11:16:23,132 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 11:16:23,132 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 11:16:23,133 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 11:16:23,133 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 11:16:27,391 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 11:16:27,391 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 11:16:27,391 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 11:16:27,392 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 11:16:28,448 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 11:16:28,449 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 11:16:28,449 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 11:18:44,888 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 11:18:45,390 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 11:18:45,597 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 11:18:45,598 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 11:18:45,598 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 11:18:45,599 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 11:18:52,547 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 11:18:52,547 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 11:18:52,548 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 11:18:52,548 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 11:18:52,548 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 11:18:52,589 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 11:18:52,598 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 11:18:52,598 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 11:18:52,756 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 11:18:52,757 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 11:18:52,757 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 11:18:52,757 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 11:18:55,271 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 11:18:55,271 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 11:18:55,272 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 11:18:55,272 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 11:18:55,901 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 11:18:55,901 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 11:18:55,901 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 11:20:08,176 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 11:20:08,723 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 11:20:08,881 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 11:20:08,882 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 11:20:08,883 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 11:20:08,884 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 11:20:15,638 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 11:20:15,638 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 11:20:15,639 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 11:20:15,639 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 11:20:15,639 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 11:20:15,729 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 11:20:15,752 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 11:20:15,752 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 11:20:16,126 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 11:20:16,126 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 11:20:16,126 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 11:20:16,127 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 11:20:20,817 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 11:20:20,817 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 11:20:20,817 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 11:20:20,817 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 11:20:21,917 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 11:20:21,918 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 11:20:21,918 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 11:25:12,415 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 11:25:13,201 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 11:25:13,437 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 11:25:13,438 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 11:25:13,438 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 11:25:13,439 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 11:25:21,258 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 11:25:21,258 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 11:25:21,258 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 11:25:21,259 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 11:25:21,259 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 11:25:21,336 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 11:25:21,359 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 11:25:21,359 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 11:25:21,689 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 11:25:21,690 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 11:25:21,690 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 11:25:21,690 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 11:25:26,157 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 11:25:26,157 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 11:25:26,158 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 11:25:26,158 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 11:25:27,293 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 11:25:27,293 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 11:25:27,294 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 11:27:36,540 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 11:27:37,303 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 11:27:37,535 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 11:27:37,536 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 11:27:37,537 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 11:27:37,538 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 11:27:44,051 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 11:27:44,051 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 11:27:44,051 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 11:27:44,051 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 11:27:44,052 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 11:27:44,125 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 11:27:44,147 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 11:27:44,147 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 11:27:44,398 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 11:27:44,398 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 11:27:44,399 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 11:27:44,399 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 11:27:48,234 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 11:27:48,235 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 11:27:48,235 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 11:27:48,235 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 11:27:49,188 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 11:27:49,188 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 11:27:49,188 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 11:29:41,997 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 11:29:42,830 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 11:29:43,121 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 11:29:43,121 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 11:29:43,122 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 11:29:43,122 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 11:29:49,822 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 11:29:49,823 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 11:29:49,823 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 11:29:49,823 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 11:29:49,824 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 11:29:49,906 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 11:29:49,927 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 11:29:49,927 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 11:29:50,257 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 11:29:50,257 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 11:29:50,258 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 11:29:50,258 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 11:29:54,437 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 11:29:54,437 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 11:29:54,437 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 11:29:54,437 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 11:29:55,407 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 11:29:55,407 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 11:29:55,407 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 13:07:11,234 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:07:15,653 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:07:16,257 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:07:16,259 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:07:16,259 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:07:16,260 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:09:08,065 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:09:08,873 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:09:09,177 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:09:09,178 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:09:09,178 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:09:09,179 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:09:20,868 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:09:20,868 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:09:20,869 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:09:20,869 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:09:20,870 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:09:21,540 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:09:21,564 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:09:21,565 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:09:21,911 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:09:21,911 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:09:21,912 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:09:21,912 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:09:26,956 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 13:09:26,957 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 13:09:26,957 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 13:09:26,957 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 13:09:28,537 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 13:09:28,537 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 13:09:28,537 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 13:10:31,109 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:10:32,065 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:10:32,376 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:10:32,377 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:10:32,377 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:10:32,377 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:10:32,628 - AgenticMedicalRAG - ERROR - Failed to load embedding model: can't register atexit after shutdown +2025-11-10 13:10:32,628 - AgenticMedicalRAG - ERROR - ❌ Background initialization failed: Failed to load embedding model +2025-11-10 13:10:32,629 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initialization failed: Failed to load embedding model (-1%) +2025-11-10 13:10:39,468 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:10:40,106 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:10:40,325 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:10:40,326 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:10:40,326 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:10:40,326 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:10:40,544 - AgenticMedicalRAG - ERROR - Failed to load embedding model: can't register atexit after shutdown +2025-11-10 13:10:40,544 - AgenticMedicalRAG - ERROR - ❌ Background initialization failed: Failed to load embedding model +2025-11-10 13:10:40,544 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initialization failed: Failed to load embedding model (-1%) +2025-11-10 13:10:47,459 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:10:48,092 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:10:48,301 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:10:48,301 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:10:48,302 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:10:48,302 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:10:55,432 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:10:55,433 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:10:55,433 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:10:55,433 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:10:55,434 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:10:55,496 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:10:55,510 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:10:55,510 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:10:55,782 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:10:55,782 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:10:55,782 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:10:55,783 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:11:09,938 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:11:10,950 - AgenticMedicalRAG - WARNING - Could not load term cache: Expecting property name enclosed in double quotes: line 3154 column 5 (char 70670) +2025-11-10 13:11:11,293 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:11:11,294 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:11:11,295 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:11:11,295 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:11:22,931 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:11:23,822 - AgenticMedicalRAG - WARNING - Could not load term cache: Expecting property name enclosed in double quotes: line 3154 column 5 (char 70670) +2025-11-10 13:11:24,160 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:11:24,161 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:11:24,161 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:11:24,162 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:11:31,208 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:11:31,208 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:11:31,208 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:11:31,209 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:11:31,209 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:11:31,304 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:11:31,326 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:11:31,327 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:11:31,695 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:11:31,695 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:11:31,696 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:11:31,696 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:11:36,434 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 13:11:36,434 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 13:11:36,435 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 13:11:36,435 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 13:11:37,230 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 13:11:37,231 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 13:11:37,231 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 13:12:13,643 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:12:14,539 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:12:14,843 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:12:14,843 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:12:14,844 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:12:14,844 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:12:21,527 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:12:21,527 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:12:21,527 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:12:21,527 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:12:21,528 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:12:21,615 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:12:21,630 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:12:21,631 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:12:21,916 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:12:21,917 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:12:21,917 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:12:21,918 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:12:25,542 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 13:12:25,542 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 13:12:25,542 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 13:12:25,543 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 13:12:26,390 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 13:12:26,391 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 13:12:26,391 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 13:12:55,048 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:12:55,709 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:12:55,942 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:12:55,943 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:12:55,944 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:12:55,944 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:13:09,470 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:13:10,107 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:13:10,327 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:13:10,328 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:13:10,328 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:13:10,329 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:13:16,934 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:13:16,935 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:13:16,935 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:13:16,935 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:13:16,936 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:13:17,000 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:13:17,014 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:13:17,015 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:13:17,287 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:13:17,288 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:13:17,288 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:13:17,288 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:13:25,262 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:13:25,889 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:13:26,099 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:13:26,099 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:13:26,100 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:13:26,100 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:13:26,339 - AgenticMedicalRAG - ERROR - Failed to load embedding model: can't register atexit after shutdown +2025-11-10 13:13:26,339 - AgenticMedicalRAG - ERROR - ❌ Background initialization failed: Failed to load embedding model +2025-11-10 13:13:26,340 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initialization failed: Failed to load embedding model (-1%) +2025-11-10 13:13:33,334 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:13:33,964 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:13:34,198 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:13:34,199 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:13:34,199 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:13:34,200 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:13:41,115 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:13:41,739 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:13:41,958 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:13:41,959 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:13:41,959 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:13:41,960 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:13:48,917 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:13:49,546 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:13:49,749 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:13:49,750 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:13:49,750 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:13:49,751 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:13:59,906 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:14:00,604 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:14:00,811 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:14:00,812 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:14:00,813 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:14:00,813 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:14:01,020 - AgenticMedicalRAG - ERROR - Failed to load embedding model: can't register atexit after shutdown +2025-11-10 13:14:01,020 - AgenticMedicalRAG - ERROR - ❌ Background initialization failed: Failed to load embedding model +2025-11-10 13:14:01,020 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initialization failed: Failed to load embedding model (-1%) +2025-11-10 13:14:08,452 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:14:09,194 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:14:09,407 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:14:09,408 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:14:09,408 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:14:09,409 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:14:15,146 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:14:15,146 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:14:15,146 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:14:15,147 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:14:15,147 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:14:15,217 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:14:15,234 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:14:15,234 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:14:15,536 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:14:15,536 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:14:15,537 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:14:15,537 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:14:19,754 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 13:14:19,755 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 13:14:19,756 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 13:14:19,756 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 13:14:20,971 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 13:14:20,971 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 13:14:20,972 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 13:14:52,152 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:14:53,215 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:14:53,506 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:14:53,507 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:14:53,508 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:14:53,508 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:15:01,471 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:15:01,471 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:15:01,472 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:15:01,472 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:15:01,472 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:15:01,558 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:15:01,580 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:15:01,581 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:15:01,912 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:15:01,912 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:15:01,912 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:15:01,913 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:15:05,630 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 13:15:05,631 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 13:15:05,631 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 13:15:05,631 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 13:15:14,054 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:15:14,717 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:15:14,921 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:15:14,922 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:15:14,922 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:15:14,923 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:15:20,808 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:15:20,808 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:15:20,808 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:15:20,808 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:15:20,809 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:15:20,902 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:15:20,919 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:15:20,919 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:15:21,191 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:15:21,191 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:15:21,191 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:15:21,192 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:15:24,412 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 13:15:24,413 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 13:15:24,413 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 13:15:24,413 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 13:15:25,264 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 13:15:25,265 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 13:15:25,265 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 13:16:19,974 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:16:21,076 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:16:21,449 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:16:21,450 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:16:21,450 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:16:21,451 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:16:29,485 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:16:29,485 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:16:29,485 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:16:29,486 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:16:29,486 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:16:29,584 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:16:29,604 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:16:29,605 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:16:29,953 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:16:29,953 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:16:29,954 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:16:29,954 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:16:35,161 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 13:16:35,161 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 13:16:35,162 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 13:16:35,162 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 13:16:36,501 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 13:16:36,502 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 13:16:36,502 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 13:19:44,747 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:19:45,391 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:19:45,604 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:19:45,605 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:19:45,605 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:19:45,606 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:19:51,291 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:19:51,291 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:19:51,291 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:19:51,292 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:19:51,292 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:19:51,367 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:19:51,382 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:19:51,382 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:19:51,660 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:19:51,660 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:19:51,660 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:19:51,661 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:19:55,478 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 13:19:55,478 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 13:19:55,479 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 13:19:55,479 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 13:19:56,278 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 13:19:56,278 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 13:19:56,278 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 13:36:49,973 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:36:50,671 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:36:50,878 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:36:50,879 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:36:50,879 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:36:50,880 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:36:51,087 - AgenticMedicalRAG - ERROR - Failed to load embedding model: can't register atexit after shutdown +2025-11-10 13:36:51,087 - AgenticMedicalRAG - ERROR - ❌ Background initialization failed: Failed to load embedding model +2025-11-10 13:36:51,087 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initialization failed: Failed to load embedding model (-1%) +2025-11-10 13:37:02,601 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:37:03,627 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:37:03,975 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:37:03,977 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:37:03,978 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:37:03,978 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:37:12,221 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:37:12,221 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:37:12,222 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:37:12,222 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:37:12,222 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:37:12,297 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:37:12,313 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:37:12,314 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:37:12,573 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:37:12,574 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:37:12,574 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:37:12,574 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:37:16,183 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 13:37:16,184 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 13:37:16,184 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 13:37:16,184 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 13:37:16,971 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 13:37:16,971 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 13:37:16,972 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 13:37:56,137 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:37:57,094 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:37:57,428 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:37:57,429 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:37:57,430 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:37:57,431 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:38:06,636 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:38:06,637 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:38:06,637 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:38:06,637 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:38:06,638 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:38:06,716 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:38:06,737 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:38:06,737 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:38:07,076 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:38:07,077 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:38:07,078 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:38:07,078 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:38:10,572 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 13:38:10,572 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 13:38:10,573 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 13:38:10,573 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 13:38:11,328 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 13:38:11,329 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 13:38:11,329 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 13:41:48,124 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:41:49,001 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:41:49,374 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:41:49,375 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:41:49,375 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:41:49,376 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:41:58,298 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:41:58,299 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:41:58,299 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:41:58,300 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:41:58,300 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:41:58,385 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:41:58,406 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:41:58,406 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:41:58,700 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:41:58,702 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:41:58,702 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:41:58,703 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:42:03,406 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 13:42:03,406 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 13:42:03,406 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 13:42:03,407 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 13:42:04,678 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 13:42:04,679 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 13:42:04,679 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 13:46:47,163 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:46:48,013 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:46:48,241 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:46:48,242 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:46:48,242 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:46:48,243 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:46:55,350 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:46:55,350 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:46:55,351 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:46:55,351 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:46:55,351 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:46:55,438 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:46:55,459 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:46:55,459 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:46:55,803 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:46:55,804 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:46:55,804 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:46:55,805 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:47:00,920 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 13:47:00,920 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 13:47:00,920 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 13:47:00,921 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 13:47:02,195 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 13:47:02,196 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 13:47:02,196 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 13:47:28,733 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:47:29,757 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:47:30,085 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:47:30,086 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:47:30,087 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:47:30,087 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:47:38,371 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:47:38,371 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:47:38,372 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:47:38,372 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:47:38,372 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:47:38,474 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:47:38,499 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:47:38,500 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:47:38,817 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:47:38,818 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:47:38,818 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:47:38,818 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:47:42,677 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 13:47:42,678 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 13:47:42,678 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 13:47:42,678 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 13:47:43,432 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 13:47:43,433 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 13:47:43,433 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 13:48:10,326 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:48:11,045 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:48:11,263 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:48:11,264 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:48:11,264 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:48:11,264 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:48:11,465 - AgenticMedicalRAG - ERROR - Failed to load embedding model: can't register atexit after shutdown +2025-11-10 13:48:11,466 - AgenticMedicalRAG - ERROR - ❌ Background initialization failed: Failed to load embedding model +2025-11-10 13:48:11,466 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initialization failed: Failed to load embedding model (-1%) +2025-11-10 13:48:18,359 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:48:19,154 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:48:19,360 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:48:19,360 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:48:19,361 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:48:19,361 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:48:26,321 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:48:26,976 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:48:27,189 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:48:27,190 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:48:27,191 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:48:27,191 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:48:34,223 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:48:34,887 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:48:35,085 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:48:35,086 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:48:35,087 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:48:35,087 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:48:42,305 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:48:43,029 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:48:43,247 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:48:43,248 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:48:43,248 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:48:43,249 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:48:50,078 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:48:50,078 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:48:50,078 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:48:50,079 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:48:50,079 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:48:50,144 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:48:50,161 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:48:50,161 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:48:50,472 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:48:50,472 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:48:50,473 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:48:50,473 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:48:58,947 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:48:59,728 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:48:59,941 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:48:59,942 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:48:59,942 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:48:59,943 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:49:08,959 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:49:10,110 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:49:10,445 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:49:10,446 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:49:10,447 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:49:10,448 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:49:20,853 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:49:21,997 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:49:22,326 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:49:22,327 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:49:22,328 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:49:22,328 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:49:30,332 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:49:30,333 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:49:30,333 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:49:30,333 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:49:30,333 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:49:30,444 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:49:30,468 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:49:30,468 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:49:30,821 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:49:30,822 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:49:30,822 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:49:30,823 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:49:35,682 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 13:49:35,683 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 13:49:35,683 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 13:49:35,683 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 13:49:36,850 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 13:49:36,850 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 13:49:36,851 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 13:51:05,827 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:51:06,705 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:51:06,913 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:51:06,914 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:51:06,915 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:51:06,915 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:51:13,555 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:51:13,556 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:51:13,556 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:51:13,557 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:51:13,557 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:51:13,649 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:51:13,666 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:51:13,667 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:51:13,946 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:51:13,947 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:51:13,947 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:51:13,947 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:51:18,320 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 13:51:18,321 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 13:51:18,321 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 13:51:18,321 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 13:51:19,619 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 13:51:19,619 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 13:51:19,619 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 13:54:35,856 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:54:36,777 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:54:37,073 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:54:37,074 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:54:37,074 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:54:37,075 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:54:44,416 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:54:44,417 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:54:44,417 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:54:44,417 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:54:44,417 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:54:44,498 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:54:44,512 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:54:44,513 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:54:44,798 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:54:44,799 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:54:44,799 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:54:44,799 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:54:48,616 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 13:54:48,616 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 13:54:48,616 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 13:54:48,617 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 13:54:49,460 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 13:54:49,461 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 13:54:49,461 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 13:55:01,658 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 13:55:02,572 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 13:55:02,866 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 13:55:02,867 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 13:55:02,868 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 13:55:02,868 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 13:55:10,919 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 13:55:10,919 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 13:55:10,919 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 13:55:10,920 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 13:55:10,920 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 13:55:11,004 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 13:55:11,024 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 13:55:11,025 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 13:55:11,346 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 13:55:11,347 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 13:55:11,347 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 13:55:11,347 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 13:55:16,251 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 13:55:16,251 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 13:55:16,252 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 13:55:16,252 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 13:55:17,416 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 13:55:17,416 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 13:55:17,417 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 14:00:54,234 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 14:00:55,158 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 14:00:55,477 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 14:00:55,477 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 14:00:55,478 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 14:00:55,478 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 14:01:02,622 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 14:01:03,439 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 14:01:03,752 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 14:01:03,753 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 14:01:03,754 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 14:01:03,755 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 14:01:12,885 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 14:01:13,648 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 14:01:13,870 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 14:01:13,871 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 14:01:13,871 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 14:01:13,871 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 14:01:22,587 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 14:01:23,636 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 14:01:23,999 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 14:01:24,000 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 14:01:24,001 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 14:01:24,001 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 14:01:32,060 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 14:01:32,757 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 14:01:32,978 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 14:01:32,979 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 14:01:32,979 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 14:01:32,979 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 14:01:41,281 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 14:01:41,281 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 14:01:41,281 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 14:01:41,282 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 14:01:41,282 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 14:01:41,397 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 14:01:41,412 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 14:01:41,413 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 14:01:41,750 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 14:01:41,751 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 14:01:41,751 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 14:01:41,752 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 14:01:45,964 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 14:01:45,965 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 14:01:45,965 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 14:01:45,965 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 14:01:47,532 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 14:01:47,532 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 14:01:47,533 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 14:18:36,136 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 14:18:37,159 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 14:18:37,580 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 14:18:37,581 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 14:18:37,582 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 14:18:37,582 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 14:18:45,706 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 14:18:45,706 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 14:18:45,706 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 14:18:45,706 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 14:18:45,707 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 14:18:45,783 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 14:18:45,804 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 14:18:45,804 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 14:18:46,163 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 14:18:46,163 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 14:18:46,163 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 14:18:46,163 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 14:18:51,105 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 14:18:51,105 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 14:18:51,106 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 14:18:51,106 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 14:18:52,386 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 14:18:52,386 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 14:18:52,386 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 14:20:18,878 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 14:20:19,658 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 14:20:28,105 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 14:20:29,101 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 14:20:29,564 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 14:20:29,565 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 14:20:29,566 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 14:20:29,566 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 14:20:38,054 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 14:20:38,054 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 14:20:38,054 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 14:20:38,055 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 14:20:38,055 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 14:20:38,147 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 14:20:38,168 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 14:20:38,169 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 14:20:38,554 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 14:20:38,555 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 14:20:38,555 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 14:20:38,556 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 14:20:42,935 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 14:20:42,936 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 14:20:42,936 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 14:20:42,936 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 14:20:44,234 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 14:20:44,234 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 14:20:44,234 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 14:21:32,941 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 14:21:33,851 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 14:21:34,067 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 14:21:34,067 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 14:21:34,068 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 14:21:34,068 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 14:21:40,837 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 14:21:40,837 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 14:21:40,838 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 14:21:40,838 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 14:21:40,838 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 14:21:40,933 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 14:21:40,954 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 14:21:40,955 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 14:21:41,292 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 14:21:41,293 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 14:21:41,293 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 14:21:41,293 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 14:21:46,365 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 14:21:46,365 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 14:21:46,366 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 14:21:46,366 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 14:21:47,610 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 14:21:47,610 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 14:21:47,611 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 14:22:17,852 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 14:22:18,608 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 14:22:26,959 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 14:22:27,753 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 14:22:28,047 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 14:22:28,048 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 14:22:28,048 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 14:22:28,049 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 14:22:35,248 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 14:22:35,249 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 14:22:35,249 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 14:22:35,249 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 14:22:35,250 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 14:22:35,337 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 14:22:35,352 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 14:22:35,353 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 14:22:35,626 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 14:22:35,627 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 14:22:35,627 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 14:22:35,627 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 14:22:39,276 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 14:22:39,276 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 14:22:39,276 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 14:22:39,277 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 14:22:40,071 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 14:22:40,072 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 14:22:40,072 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 14:25:55,342 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 14:25:56,357 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 14:25:56,695 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 14:25:56,696 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 14:25:56,696 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 14:25:56,697 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 14:26:04,550 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 14:26:04,550 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 14:26:04,551 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 14:26:04,551 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 14:26:04,551 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 14:26:04,656 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 14:26:04,683 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 14:26:04,684 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 14:26:05,201 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 14:26:05,202 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 14:26:05,202 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 14:26:05,202 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 14:26:10,376 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 14:26:10,376 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 14:26:10,376 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 14:26:10,377 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 14:26:11,699 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 14:26:11,699 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 14:26:11,699 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 14:27:49,505 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 14:27:50,547 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 14:28:01,735 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 14:28:02,839 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 14:28:03,198 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 14:28:03,199 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 14:28:03,199 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 14:28:03,200 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 14:28:11,426 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 14:28:11,426 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 14:28:11,427 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 14:28:11,427 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 14:28:11,427 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 14:28:11,525 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 14:28:11,553 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 14:28:11,553 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 14:28:11,887 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 14:28:11,888 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 14:28:11,889 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 14:28:11,889 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 14:28:17,079 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 14:28:17,080 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 14:28:17,080 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 14:28:17,081 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 14:28:18,387 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 14:28:18,388 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 14:28:18,388 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 14:30:22,108 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 14:30:23,146 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 14:30:23,473 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 14:30:23,474 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 14:30:23,475 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 14:30:23,475 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 14:30:31,668 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 14:30:31,668 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 14:30:31,668 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 14:30:31,668 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 14:30:31,669 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 14:30:31,756 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 14:30:31,779 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 14:30:31,779 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 14:30:32,135 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 14:30:32,136 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 14:30:32,136 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 14:30:32,137 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 14:30:37,054 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 14:30:37,055 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 14:30:37,055 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 14:30:37,056 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 14:30:38,349 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 14:30:38,350 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 14:30:38,350 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 14:36:17,679 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 14:36:18,591 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 14:36:18,932 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 14:36:18,933 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 14:36:18,934 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 14:36:18,934 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 14:36:26,919 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 14:36:26,919 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 14:36:26,919 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 14:36:26,920 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 14:36:26,920 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 14:36:27,043 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 14:36:27,072 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 14:36:27,073 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 14:36:27,417 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 14:36:27,418 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 14:36:27,418 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 14:36:27,418 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 14:36:32,520 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 14:36:32,521 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 14:36:32,521 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 14:36:32,522 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 14:36:33,803 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 14:36:33,804 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 14:36:33,804 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 14:37:30,370 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 14:37:31,260 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 14:37:31,626 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 14:37:31,627 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 14:37:31,628 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 14:37:31,628 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 14:37:40,776 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 14:37:40,776 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 14:37:40,776 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 14:37:40,777 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 14:37:40,777 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 14:37:40,856 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 14:37:40,874 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 14:37:40,874 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 14:37:41,206 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 14:37:41,207 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 14:37:41,207 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 14:37:41,207 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 14:37:46,342 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 14:37:46,345 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 14:37:46,346 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 14:37:46,346 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 14:37:47,723 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 14:37:47,723 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 14:37:47,724 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 14:40:29,431 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 14:40:30,382 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 14:40:30,699 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 14:40:30,700 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 14:40:30,701 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 14:40:30,702 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 14:40:39,897 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 14:40:39,898 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 14:40:39,898 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 14:40:39,899 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 14:40:39,899 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 14:40:39,977 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 14:40:39,995 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 14:40:39,996 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 14:40:40,345 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 14:40:40,346 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 14:40:40,346 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 14:40:40,346 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 14:40:45,401 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 14:40:45,401 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 14:40:45,402 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 14:40:45,402 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 14:40:46,682 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 14:40:46,683 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 14:40:46,683 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 14:42:28,415 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 14:42:29,436 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 14:42:29,780 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 14:42:29,782 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 14:42:29,782 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 14:42:29,783 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 14:42:35,606 - AgenticMedicalRAG - INFO - Successfully loaded existing vector store +2025-11-10 14:42:39,047 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 14:42:39,047 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 14:42:39,048 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 14:42:39,048 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 14:42:39,048 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 14:42:39,090 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 14:42:39,123 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 14:42:39,124 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 14:42:39,891 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 14:42:39,891 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 14:42:39,892 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 14:42:39,892 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 14:42:42,918 - AgenticMedicalRAG - INFO - Successfully loaded existing vector store +2025-11-10 14:42:44,736 - AgenticMedicalRAG - INFO - Successfully loaded existing vector store +2025-11-10 14:42:44,816 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 14:42:44,817 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 14:42:44,817 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 14:42:44,818 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 14:42:46,051 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 14:42:46,052 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 14:42:46,052 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 14:43:09,233 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): Give me the options for first line treatment for N... +2025-11-10 14:43:11,759 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-11-10 14:43:11,759 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-11-10 14:43:12,357 - AgenticMedicalRAG - INFO - Hybrid search returned 6 unique documents (query expansion: False) +2025-11-10 14:43:12,379 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-10 14:43:12,379 - AgenticMedicalRAG - INFO - Retrieved 6 documents from NCCN +2025-11-10 14:43:12,379 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-11-10 14:43:12,448 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-11-10 14:43:12,450 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-10 14:43:12,450 - AgenticMedicalRAG - INFO - Retrieved 1 documents from ASCO +2025-11-10 14:43:12,450 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-11-10 14:43:12,514 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: False) +2025-11-10 14:43:12,516 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-10 14:43:12,516 - AgenticMedicalRAG - INFO - Retrieved 2 documents from ESMO +2025-11-10 14:43:12,517 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-11-10 14:43:12,581 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-11-10 14:43:12,582 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-11-10 14:43:12,643 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-11-10 14:43:13,435 - AgenticMedicalRAG - ERROR - OpenAI API error: Error code: 413 - {'error': {'code': 'tokens_limit_reached', 'message': 'Request body too large for gpt-4o model. Max size: 8000 tokens.', 'details': 'Request body too large for gpt-4o model. Max size: 8000 tokens.'}} +2025-11-10 14:43:15,436 - AgenticMedicalRAG - INFO - Processing user input (attempt 2): Give me the options for first line treatment for N... +2025-11-10 14:43:17,268 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-11-10 14:43:17,269 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-11-10 14:43:17,338 - AgenticMedicalRAG - INFO - Hybrid search returned 6 unique documents (query expansion: False) +2025-11-10 14:43:17,339 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-10 14:43:17,339 - AgenticMedicalRAG - INFO - Retrieved 6 documents from NCCN +2025-11-10 14:43:17,339 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-11-10 14:43:17,402 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-11-10 14:43:17,403 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-10 14:43:17,403 - AgenticMedicalRAG - INFO - Retrieved 1 documents from ASCO +2025-11-10 14:43:17,403 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-11-10 14:43:17,465 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: False) +2025-11-10 14:43:17,466 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-10 14:43:17,466 - AgenticMedicalRAG - INFO - Retrieved 2 documents from ESMO +2025-11-10 14:43:17,466 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-11-10 14:43:17,528 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-11-10 14:43:17,529 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-11-10 14:43:17,590 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-11-10 14:43:18,089 - AgenticMedicalRAG - ERROR - OpenAI API error: Error code: 413 - {'error': {'code': 'tokens_limit_reached', 'message': 'Request body too large for gpt-4o model. Max size: 8000 tokens.', 'details': 'Request body too large for gpt-4o model. Max size: 8000 tokens.'}} +2025-11-10 14:43:20,089 - AgenticMedicalRAG - INFO - Processing user input (attempt 3): Give me the options for first line treatment for N... +2025-11-10 14:43:22,070 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-11-10 14:43:22,070 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-11-10 14:43:22,151 - AgenticMedicalRAG - INFO - Hybrid search returned 6 unique documents (query expansion: False) +2025-11-10 14:43:22,152 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-10 14:43:22,152 - AgenticMedicalRAG - INFO - Retrieved 6 documents from NCCN +2025-11-10 14:43:22,152 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-11-10 14:43:22,214 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-11-10 14:43:22,214 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-10 14:43:22,215 - AgenticMedicalRAG - INFO - Retrieved 1 documents from ASCO +2025-11-10 14:43:22,215 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-11-10 14:43:22,277 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: False) +2025-11-10 14:43:22,277 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-10 14:43:22,278 - AgenticMedicalRAG - INFO - Retrieved 2 documents from ESMO +2025-11-10 14:43:22,278 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-11-10 14:43:22,340 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-11-10 14:43:22,340 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-11-10 14:43:22,403 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-11-10 14:43:22,879 - AgenticMedicalRAG - ERROR - OpenAI API error: Error code: 413 - {'error': {'code': 'tokens_limit_reached', 'message': 'Request body too large for gpt-4o model. Max size: 8000 tokens.', 'details': 'Request body too large for gpt-4o model. Max size: 8000 tokens.'}} +2025-11-10 14:43:24,881 - AgenticMedicalRAG - INFO - Processing user input (attempt 4): Give me the options for first line treatment for N... +2025-11-10 14:43:26,404 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-11-10 14:43:26,404 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-11-10 14:43:26,479 - AgenticMedicalRAG - INFO - Hybrid search returned 6 unique documents (query expansion: False) +2025-11-10 14:43:26,480 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-10 14:43:26,480 - AgenticMedicalRAG - INFO - Retrieved 6 documents from NCCN +2025-11-10 14:43:26,481 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-11-10 14:43:26,544 - AgenticMedicalRAG - INFO - Hybrid search returned 1 unique documents (query expansion: False) +2025-11-10 14:43:26,544 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-10 14:43:26,544 - AgenticMedicalRAG - INFO - Retrieved 1 documents from ASCO +2025-11-10 14:43:26,545 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-11-10 14:43:26,608 - AgenticMedicalRAG - INFO - Hybrid search returned 2 unique documents (query expansion: False) +2025-11-10 14:43:26,608 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-10 14:43:26,608 - AgenticMedicalRAG - INFO - Retrieved 2 documents from ESMO +2025-11-10 14:43:26,609 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-11-10 14:43:26,672 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-11-10 14:43:26,672 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-11-10 14:43:26,735 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-11-10 14:43:26,977 - AgenticMedicalRAG - ERROR - OpenAI API error: Error code: 413 - {'error': {'code': 'tokens_limit_reached', 'message': 'Request body too large for gpt-4o model. Max size: 8000 tokens.', 'details': 'Request body too large for gpt-4o model. Max size: 8000 tokens.'}} +2025-11-10 15:03:07,902 - AgenticMedicalRAG - INFO - Configuration validation completed +2025-11-10 15:03:08,385 - AgenticMedicalRAG - INFO - Loaded 877 learned synonyms from cache +2025-11-10 15:03:08,547 - AgenticMedicalRAG - INFO - 🚀 Starting background initialization... +2025-11-10 15:03:08,547 - AgenticMedicalRAG - INFO - 🔄 Background Init: Starting background initialization... (0%) +2025-11-10 15:03:08,547 - AgenticMedicalRAG - INFO - 🔄 Background Init: Loading embedding model... (10%) +2025-11-10 15:03:08,548 - AgenticMedicalRAG - INFO - Loading embedding model (first time)... +2025-11-10 15:03:14,257 - AgenticMedicalRAG - INFO - Embedding model loaded successfully +2025-11-10 15:03:14,257 - AgenticMedicalRAG - INFO - 🔄 Background Init: Embedding model loaded successfully (40%) +2025-11-10 15:03:14,257 - AgenticMedicalRAG - INFO - 🔄 Background Init: Initializing retrievers and loading chunks... (50%) +2025-11-10 15:03:14,258 - AgenticMedicalRAG - INFO - 🔄 Initializing retrievers (first time use)... +2025-11-10 15:03:14,258 - AgenticMedicalRAG - INFO - 🔄 Processing new data and updating vector store if needed... +2025-11-10 15:03:14,303 - AgenticMedicalRAG - INFO - 📦 Loading chunks cache for BM25 retriever... +2025-11-10 15:03:14,313 - AgenticMedicalRAG - INFO - 🔍 Creating vector retriever... +2025-11-10 15:03:14,314 - AgenticMedicalRAG - INFO - 📝 Creating BM25 retriever... +2025-11-10 15:03:14,479 - AgenticMedicalRAG - INFO - 🔄 Creating hybrid retriever... +2025-11-10 15:03:14,479 - AgenticMedicalRAG - INFO - ✅ Retrievers initialized successfully. +2025-11-10 15:03:14,479 - AgenticMedicalRAG - INFO - 🔄 Background Init: Retrievers initialized successfully (90%) +2025-11-10 15:03:14,480 - AgenticMedicalRAG - INFO - 🔄 Background Init: Learning medical terminology from corpus... (92%) +2025-11-10 15:03:16,849 - AgenticMedicalRAG - INFO - Saved learned terms to cache +2025-11-10 15:03:16,849 - AgenticMedicalRAG - INFO - Learned medical terminology from 1000 documents +2025-11-10 15:03:16,849 - AgenticMedicalRAG - INFO - 🔄 Background Init: Warming up LLM... (97%) +2025-11-10 15:03:16,850 - AgenticMedicalRAG - INFO - Initializing LLM (first time)... +2025-11-10 15:03:17,410 - AgenticMedicalRAG - INFO - LLM initialized successfully +2025-11-10 15:03:17,410 - AgenticMedicalRAG - INFO - 🔄 Background Init: All components initialized successfully (100%) +2025-11-10 15:03:17,410 - AgenticMedicalRAG - INFO - ✅ Background initialization completed successfully +2025-11-10 15:04:10,770 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): Give me the options for first line treatment for N... +2025-11-10 15:04:12,436 - AgenticMedicalRAG - INFO - No specific provider - querying each provider separately for balanced results +2025-11-10 15:04:12,436 - AgenticMedicalRAG - INFO - Querying provider: NCCN +2025-11-10 15:04:12,580 - AgenticMedicalRAG - INFO - Hybrid search returned 5 unique documents (query expansion: False) +2025-11-10 15:04:12,600 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-10 15:04:12,600 - AgenticMedicalRAG - INFO - Retrieved 5 documents from NCCN +2025-11-10 15:04:12,601 - AgenticMedicalRAG - INFO - Querying provider: ASCO +2025-11-10 15:04:12,663 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-11-10 15:04:12,664 - AgenticMedicalRAG - INFO - Querying provider: ESMO +2025-11-10 15:04:12,722 - AgenticMedicalRAG - INFO - Hybrid search returned 3 unique documents (query expansion: False) +2025-11-10 15:04:12,724 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-10 15:04:12,724 - AgenticMedicalRAG - INFO - Retrieved 3 documents from ESMO +2025-11-10 15:04:12,724 - AgenticMedicalRAG - INFO - Querying provider: NICE +2025-11-10 15:04:12,783 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-11-10 15:04:12,783 - AgenticMedicalRAG - INFO - Querying provider: Manus +2025-11-10 15:04:12,843 - AgenticMedicalRAG - INFO - Hybrid search returned 0 unique documents (query expansion: False) +2025-11-10 15:04:32,580 - AgenticMedicalRAG - INFO - Successfully processed user input: Give me the options for first line treatment for N... +2025-11-10 15:04:32,580 - AgenticMedicalRAG - INFO - Performing background validation... +2025-11-10 15:04:33,305 - AgenticMedicalRAG - INFO - Medical answer validator initialized successfully +2025-11-10 15:04:33,305 - AgenticMedicalRAG - INFO - GitHub token configured: ghp_KWH...dnCc +2025-11-10 15:04:33,305 - AgenticMedicalRAG - INFO - GitHub storage initialized for MoazEldsouky/cloud-data-store +2025-11-10 15:04:34,103 - AgenticMedicalRAG - INFO - Found 7 existing evaluations in GitHub +2025-11-10 15:04:34,103 - AgenticMedicalRAG - INFO - Next interaction ID will be: 8 +2025-11-10 15:04:34,104 - AgenticMedicalRAG - INFO - Starting validation for interaction 8 +2025-11-10 15:04:54,927 - AgenticMedicalRAG - INFO - Attempting to save evaluation with ID: 8 +2025-11-10 15:04:54,927 - AgenticMedicalRAG - INFO - GitHub storage instance obtained, calling save_validation_results... +2025-11-10 15:04:54,927 - AgenticMedicalRAG - INFO - Attempt 1/3: Loading existing evaluations from GitHub... +2025-11-10 15:04:55,633 - AgenticMedicalRAG - INFO - Successfully loaded 7 existing evaluations +2025-11-10 15:04:55,633 - AgenticMedicalRAG - INFO - Adding new evaluation with ID: 8 +2025-11-10 15:04:55,633 - AgenticMedicalRAG - INFO - Appended new evaluation. Total count: 8 +2025-11-10 15:04:56,828 - AgenticMedicalRAG - INFO - Uploading to GitHub: medical_data/evaluation_results.json (size: 499571 bytes) +2025-11-10 15:04:59,447 - AgenticMedicalRAG - INFO - ✓ Successfully uploaded medical_data/evaluation_results.json to GitHub +2025-11-10 15:04:59,448 - AgenticMedicalRAG - INFO - ✓ Successfully saved evaluation 8. Total evaluations now: 8 +2025-11-10 15:04:59,449 - AgenticMedicalRAG - INFO - ✓ Evaluation saved to GitHub successfully with ID: 8 +2025-11-10 15:04:59,450 - AgenticMedicalRAG - INFO - Background validation completed - Interaction ID: 8 +2025-11-10 15:04:59,450 - AgenticMedicalRAG - INFO - Validation scores - Overall: 90/100, Accuracy: 95/100, Coherence: 90/100, Relevance: 88/100 +2025-11-10 15:06:18,298 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): Give me the options for first line treatment for N... +2025-11-10 15:06:19,507 - AgenticMedicalRAG - INFO - Querying specific provider: NCCN +2025-11-10 15:06:19,567 - AgenticMedicalRAG - INFO - Hybrid search returned 5 unique documents (query expansion: False) +2025-11-10 15:06:19,567 - AgenticMedicalRAG - INFO - Enriched 1 documents with surrounding context pages +2025-11-10 15:06:19,568 - AgenticMedicalRAG - INFO - Retrieved 5 documents, added 2 context pages +2025-11-10 15:06:35,483 - AgenticMedicalRAG - INFO - Performing background validation for streaming response... +2025-11-10 15:06:36,769 - AgenticMedicalRAG - INFO - Found 8 existing evaluations in GitHub +2025-11-10 15:06:36,769 - AgenticMedicalRAG - INFO - Next interaction ID will be: 9 +2025-11-10 15:06:36,769 - AgenticMedicalRAG - INFO - Starting validation for interaction 9 +2025-11-10 15:06:49,900 - AgenticMedicalRAG - INFO - Attempting to save evaluation with ID: 9 +2025-11-10 15:06:49,901 - AgenticMedicalRAG - INFO - GitHub storage instance obtained, calling save_validation_results... +2025-11-10 15:06:49,901 - AgenticMedicalRAG - INFO - Attempt 1/3: Loading existing evaluations from GitHub... +2025-11-10 15:06:50,698 - AgenticMedicalRAG - INFO - Successfully loaded 8 existing evaluations +2025-11-10 15:06:50,698 - AgenticMedicalRAG - INFO - Adding new evaluation with ID: 9 +2025-11-10 15:06:50,698 - AgenticMedicalRAG - INFO - Appended new evaluation. Total count: 9 +2025-11-10 15:06:52,202 - AgenticMedicalRAG - INFO - Uploading to GitHub: medical_data/evaluation_results.json (size: 516689 bytes) +2025-11-10 15:06:55,181 - AgenticMedicalRAG - INFO - ✓ Successfully uploaded medical_data/evaluation_results.json to GitHub +2025-11-10 15:06:55,181 - AgenticMedicalRAG - INFO - ✓ Successfully saved evaluation 9. Total evaluations now: 9 +2025-11-10 15:06:55,182 - AgenticMedicalRAG - INFO - ✓ Evaluation saved to GitHub successfully with ID: 9 +2025-11-10 15:06:55,182 - AgenticMedicalRAG - INFO - Background validation completed - Interaction ID: 9 +2025-11-10 15:06:55,182 - AgenticMedicalRAG - INFO - Validation scores - Overall: 90/100, Accuracy: 95/100, Coherence: 90/100, Relevance: 88/100 +2025-11-10 15:06:55,183 - AgenticMedicalRAG - INFO - Successfully processed user input: Give me the options for first line treatment for N... +2025-11-10 15:09:45,375 - AgenticMedicalRAG - INFO - Processing user input (attempt 1): what questions i asked?... +2025-11-10 15:09:46,556 - AgenticMedicalRAG - INFO - Performing background validation for streaming response... +2025-11-10 15:09:47,853 - AgenticMedicalRAG - INFO - Found 9 existing evaluations in GitHub +2025-11-10 15:09:47,853 - AgenticMedicalRAG - INFO - Next interaction ID will be: 10 +2025-11-10 15:09:47,854 - AgenticMedicalRAG - INFO - Starting validation for interaction 10 +2025-11-10 15:09:57,584 - AgenticMedicalRAG - INFO - Attempting to save evaluation with ID: 10 +2025-11-10 15:09:57,584 - AgenticMedicalRAG - INFO - GitHub storage instance obtained, calling save_validation_results... +2025-11-10 15:09:57,584 - AgenticMedicalRAG - INFO - Attempt 1/3: Loading existing evaluations from GitHub... +2025-11-10 15:09:58,789 - AgenticMedicalRAG - INFO - Successfully loaded 9 existing evaluations +2025-11-10 15:09:58,790 - AgenticMedicalRAG - INFO - Adding new evaluation with ID: 10 +2025-11-10 15:09:58,790 - AgenticMedicalRAG - INFO - Appended new evaluation. Total count: 10 +2025-11-10 15:09:59,477 - AgenticMedicalRAG - INFO - Uploading to GitHub: medical_data/evaluation_results.json (size: 531769 bytes) +2025-11-10 15:10:03,543 - AgenticMedicalRAG - INFO - ✓ Successfully uploaded medical_data/evaluation_results.json to GitHub +2025-11-10 15:10:03,544 - AgenticMedicalRAG - INFO - ✓ Successfully saved evaluation 10. Total evaluations now: 10 +2025-11-10 15:10:03,545 - AgenticMedicalRAG - INFO - ✓ Evaluation saved to GitHub successfully with ID: 10 +2025-11-10 15:10:03,545 - AgenticMedicalRAG - INFO - Background validation completed - Interaction ID: 10 +2025-11-10 15:10:03,545 - AgenticMedicalRAG - INFO - Validation scores - Overall: 97/100, Accuracy: 95/100, Coherence: 100/100, Relevance: 100/100 +2025-11-10 15:10:03,545 - AgenticMedicalRAG - INFO - Successfully processed user input: what questions i asked?...