Spaces:
Sleeping
Sleeping
Commit History
-
Change top_k from 3 to 10 trials for better coverage
Your Name +1: Claude10 trials = ~7,790 chars, fits comfortably in 12k context window Provides better coverage while still focused Changed 3 locations: - Line 1475: General queries - Line 1644: COMPARE queries - Line 1676: SEARCH_TRIALS queries 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>b1071b6 -
CRITICAL FIX: Reduce trials from 30→3 + add entity extraction fallback
Your Name +1: ClaudeROOT CAUSE: Best trial was at position #24, never reached LLM - Query "Ianalumab for Sjogren's" found 64 trials - NCT05985915 (perfect match) ranked #24 instead of #1 - Entity extraction returned empty → no boosting - 12000 char context cut off before #24 - LLM correctly said "no direct trials" because it didn't see them FIX 1: Reduce top_k from 30 → 3 trials - User confirmed: "answer is in first 1-2 trials" - Changed 3 locations: lines 1422, 1591, 1623 - Now only sends best 3 trials to LLM FIX 2: Robust entity extraction with regex fallback - If LLM returns empty, use regex patterns - Extracts: Ianalumab, Sjogren's, common drugs (-mab, -nib) - Lines 1145-1181: Primary fallback - Lines 1186-1210: Emergency fallback - Ensures entities are NEVER empty FIX 3: Remove "dataset" terminology - Changed "Available Clinical Trial Data" → "Clinical Trials Retrieved" - Line 1303 - Users don't know about dataset, only see trial results EXPECTED RESULTS: - Entity extraction finds: Drugs: [Ianalu…5b3af4d -
Fix entity extraction parsing to handle brackets and quotes
Your Name +1: ClaudeCRITICAL FIX: Entity extraction was returning empty results Issue: New comprehensive prompt returns lists with brackets like: DRUGS: [Ianalumab, VAY736, ...] But old parser expected: DRUGS: Ianalumab, VAY736 Fix: - Strip brackets: drugs.strip('[]') - Strip quotes: .strip('"\'') - Filter empty values: if d.strip() - Handle missing SEARCH_TERMS with fallback This fixes the bug where "Ianalumab for Sjogren's" returned 0 entities and searched irrelevant trials (vaping, HIV, etc.) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>b2b0c37 -
Merge remote changes - keep improved prompts
Your Name +1: ClaudeResolved conflict by keeping local version with all 3 upgraded LLM prompts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>8df8093 -
Upgrade all 3 LLM prompts for intelligent RAG responses
Your Name +1: ClaudeMAJOR IMPROVEMENTS: 1. Entity Extraction (API Call #1): - Comprehensive synonym generation using LLM intelligence - Examples: "Pfizer COVID vaccine" → Comirnaty, BNT162b2, tozinameran - Increased max_tokens: 256 → 500 for expansive synonyms - Temperature: 0.1 → 0.3 for creative synonym brainstorming 2. Planning Agent (API Call #2): - Defaults to SEARCH_TRIALS for data-driven answers - Added FOCUS field to guide final answer (efficacy, safety, etc.) - Clearer routing rules with "when in doubt, search trials" - Better handling of edge cases 3. Final Summary (API Call #3) - COMPLETE REWRITE: - NEVER says "no relevant trials found" - Intelligently extracts insights from partial matches - Context window: 6000 → 12,000 chars (2x increase) - Max tokens: 1024 → 2,000 (comprehensive answers) - Recognizes synonyms (Sinopharm = BBIBP-CorV) - New structure: DIRECT ANSWER → KEY EVIDENCE → INSIGHTS → CONTEXT - Works with imperfect matches (same drug, d…0ccc0c7 -
Remove warning note - let LLM analyze data naturally
Your Name +1: ClaudeProblem: Warning note was making LLM give weak answers - "⚠️ No trials found with 'Sinopharm' as sponsor" - LLM focused on what's NOT there instead of what IS there - Result: "No relevant information found" even with 30 COVID vaccine trials Solution: Remove the warning note entirely - LLM now sees 30 trials and analyzes them naturally - Will make the best answer from whatever data is available - For "Sinopharm covid vaccines": sees BBIBP-CorV trials and provides useful analysis Before: - Query: "sinopharm covid vaccines" - LLM: "No trials found with Sinopharm as sponsor. No relevant information." - User: Frustrated, data was there! After: - Query: "sinopharm covid vaccines" - LLM: "Found 30 trials studying Sinopharm's BBIBP-CorV vaccine..." - User: Gets useful information! The LLM is smart enough to analyze whatever data it gets without being told "this isn't exactly what you asked for." 🤖 Generated with Claude Code https://claude.com/claude-code Co-Authored-By: Claude <noreply@…e7f2f15 -
Replace Groq with HuggingFace for planning agent
Your Name +1: ClaudeChange: All 3 LLM calls now use HuggingFace Inference API with HF_TOKEN Before: - Step 0 (Entity extraction): HuggingFace ✓ - Step 0.5 (Planning agent): Groq ✗ (required GROQ_API_KEY) - Step 3 (Final summary): HuggingFace ✓ After: - Step 0 (Entity extraction): HuggingFace ✓ - Step 0.5 (Planning agent): HuggingFace ✓ - Step 3 (Final summary): HuggingFace ✓ Changes: - plan_query_action() now uses InferenceClient instead of Groq - Removed dependency on GROQ_API_KEY environment variable - Added hf_token parameter to plan_query_action() - Updated call site to pass hf_token Benefits: - Single API key (HF_TOKEN) for entire system - No more "Groq not available" fallback - Consistent API interface across all LLM calls - ~2s slower for planning (HF vs Groq) but no extra setup needed Trade-off: - Planning agent: ~3s (HuggingFace) vs ~0.5s (Groq) - But total pipeline still ~25s (mostly RAG search time) 🤖 Generated with Claude Code https://claude.com/claude-code Co-Authored-By: Claude <nore…463d018 -
Fix: Graceful fallback when company filter finds nothing + top 30 results
Your Name +1: ClaudeProblem 1: Company filter too strict - Query "Sinopharm covid vaccine" found 0 results - Filter failed silently with no fallback - User got "No matching trials found" even though related trials exist Fix: - Save original keyword scores before filtering - If company filter returns 0 results, fall back to original scores - Add warning note to context for LLM: "No trials found with 'Sinopharm' as sponsor. Related trials below. Please provide general knowledge if available." - LLM can now answer: "While I don't have Sinopharm trials in database, here are related COVID vaccine trials..." Problem 2: Only returned 3 trials (too few) - Changed top_k from 3 → 30 in all search calls - More comprehensive results for LLM to analyze - Better for comparison queries (30 trials per treatment) Result: - No more silent failures on company queries - LLM provides useful answer even when exact match not found - 10x more trial context for better responses 🤖 Generated with Claude Code https://cla…c7b2943 -
Add LLM-powered COMPARE and Analytics tracking
Your Name +1: ClaudeFeature #5: COMPARE - LLM handles treatment comparisons - Planning agent now detects comparison queries (vs, versus, compare) - Retrieves top 5 trials for each treatment - LLM analyzes both sets and provides comparison: * Number of trials * Key indications * Trial phases * Efficacy/safety findings * Head-to-head trials - Example: "Opdivo vs Keytruda" → LLM compares both treatments Feature #6: Analytics Tracking - Tracks query types, response times, error rates - Records every query: type, duration, success/failure - get_analytics_report() provides monitoring dashboard: * Uptime * Total queries * Error rate * Query type distribution with percentages * Average response time per type - Lightweight in-memory tracking (no database needed) Both features use LLM intelligence instead of hardcoded logic: - COMPARE: LLM does the analysis (not hardcoded metrics) - Analytics: Infrastructure tracking + LLM can summarize trends Benefits: - No hardcoded comparison logic to main…c3275de -
Add LLM-based drug synonym expansion
Your Name +1: ClaudeEnhancement: Entity extraction now automatically expands drug names with all known synonyms (brand names, generic names, research codes). Example: - User queries: "Keytruda side effects" - LLM extracts: ['Keytruda', 'pembrolizumab', 'MK-3475', 'lambrolizumab'] - Search finds trials using ANY of these names Benefits: - No hardcoded synonym list to maintain - Works for any drug (not just 10 common ones) - LLM knows thousands of drug synonyms from medical training - Handles misspellings and variations - Zero extra API calls (enhances existing extraction) This solves the problem where users search "Keytruda" but trials use "pembrolizumab" and get no matches. 🤖 Generated with Claude Code https://claude.com/claude-code Co-Authored-By: Claude <noreply@anthropic.com>67254be -
Fix: Add STRICT company filtering to search
Your Name +1: ClaudeCRITICAL FIX: Search now enforces hard filters for company entities Before: Query "Novo Nordisk diabetes drugs" would return ANY diabetes trial, completely ignoring the company filter. After: ONLY returns trials where Novo Nordisk appears in SPONSOR/COLLABORATOR/MANUFACTURER fields. Changes: - retrieve_context_with_embeddings() now accepts entities parameter - Strict filtering applied BEFORE semantic scoring - 10x score boost for company-matched trials - Early exit if no company matches found Fixes the core retrieval problem identified by user. 🤖 Generated with Claude Code https://claude.com/claude-code Co-Authored-By: Claude <noreply@anthropic.com>5c6c85e -
Add planning agent and comprehensive index
Your Name +1: Claude- Add LLM-based query routing with Groq Llama-70B - Routes queries to SEARCH_TRIALS, COUNT_AGGREGATE, or GENERAL_KNOWLEDGE - Switch to comprehensive index (1.1M terms, all global sponsors) - Fixes 'Novartis latest drugs' query failures 🤖 Generated with Claude Code https://claude.com/claude-code Co-Authored-By: Claude <noreply@anthropic.com>ca8929a
-
Download comprehensive inverted index from dataset (304k terms, Novartis: 431 trials)
Your Name8abc0e2 -
Upload foundation_engine.py with huggingface_hub
Verified signaturebd646b8 -
Upload inverted_index_TRIAL_AWARE.pkl with huggingface_hub
Verified signatureda112b0 -
Clone api2 for experimentation
Your Name +1: ClaudeExperiment space for testing changes before production: - FastAPI REST endpoint - LLM query parser (Llama 70B) - Targeted indexing (drugs, diseases, companies, endpoints) - Groq API support (10x faster) - Hybrid RAG search - Docker deployment Clone of api2 with all latest optimizations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>d78f02a -
initial commit
Verified signatured5f8324