Spaces:
Running
Running
Commit
·
8625ded
1
Parent(s):
e67c99f
docs: update demos to use all 3 search sources
Browse files- Remove stale DuckDuckGo references from README
- Update all demos to use PubMed + ClinicalTrials + bioRxiv
- Update docstrings and summary messages
- All 76 tests passing
Files updated:
- examples/README.md
- examples/full_stack_demo/run_full.py
- examples/hypothesis_demo/run_hypothesis.py
- examples/orchestrator_demo/run_agent.py
- examples/orchestrator_demo/run_magentic.py
examples/README.md
CHANGED
|
@@ -28,16 +28,17 @@ NCBI_API_KEY=your-key
|
|
| 28 |
|
| 29 |
### 1. Search Demo (No LLM Required)
|
| 30 |
|
| 31 |
-
Demonstrates REAL parallel search across PubMed and
|
| 32 |
|
| 33 |
```bash
|
| 34 |
uv run python examples/search_demo/run_search.py "metformin cancer"
|
| 35 |
```
|
| 36 |
|
| 37 |
**What's REAL:**
|
| 38 |
-
- Actual NCBI E-utilities API calls
|
| 39 |
-
- Actual
|
| 40 |
-
-
|
|
|
|
| 41 |
|
| 42 |
---
|
| 43 |
|
|
@@ -67,7 +68,7 @@ uv run python examples/orchestrator_demo/run_agent.py "aspirin alzheimer" --iter
|
|
| 67 |
```
|
| 68 |
|
| 69 |
**What's REAL:**
|
| 70 |
-
- Real PubMed +
|
| 71 |
- Real LLM judge evaluating evidence quality
|
| 72 |
- Real iterative refinement based on LLM decisions
|
| 73 |
- Real research synthesis
|
|
@@ -117,7 +118,7 @@ uv run python examples/full_stack_demo/run_full.py "sildenafil heart failure" -i
|
|
| 117 |
```
|
| 118 |
|
| 119 |
**What's REAL:**
|
| 120 |
-
1. Real PubMed +
|
| 121 |
2. Real embedding-based semantic deduplication
|
| 122 |
3. Real LLM mechanistic hypothesis generation
|
| 123 |
4. Real LLM evidence quality assessment
|
|
@@ -146,7 +147,7 @@ Output: Publication-quality research report with validated citations.
|
|
| 146 |
User Query
|
| 147 |
|
|
| 148 |
v
|
| 149 |
-
[REAL Search] -->
|
| 150 |
|
|
| 151 |
v
|
| 152 |
[REAL Embeddings] --> Actual sentence-transformers
|
|
|
|
| 28 |
|
| 29 |
### 1. Search Demo (No LLM Required)
|
| 30 |
|
| 31 |
+
Demonstrates REAL parallel search across PubMed, ClinicalTrials.gov, and bioRxiv/medRxiv.
|
| 32 |
|
| 33 |
```bash
|
| 34 |
uv run python examples/search_demo/run_search.py "metformin cancer"
|
| 35 |
```
|
| 36 |
|
| 37 |
**What's REAL:**
|
| 38 |
+
- Actual NCBI E-utilities API calls (PubMed)
|
| 39 |
+
- Actual ClinicalTrials.gov API calls
|
| 40 |
+
- Actual bioRxiv/medRxiv preprint API calls
|
| 41 |
+
- Real papers, real trials, real preprints
|
| 42 |
|
| 43 |
---
|
| 44 |
|
|
|
|
| 68 |
```
|
| 69 |
|
| 70 |
**What's REAL:**
|
| 71 |
+
- Real PubMed + ClinicalTrials + bioRxiv searches
|
| 72 |
- Real LLM judge evaluating evidence quality
|
| 73 |
- Real iterative refinement based on LLM decisions
|
| 74 |
- Real research synthesis
|
|
|
|
| 118 |
```
|
| 119 |
|
| 120 |
**What's REAL:**
|
| 121 |
+
1. Real PubMed + ClinicalTrials + bioRxiv evidence collection
|
| 122 |
2. Real embedding-based semantic deduplication
|
| 123 |
3. Real LLM mechanistic hypothesis generation
|
| 124 |
4. Real LLM evidence quality assessment
|
|
|
|
| 147 |
User Query
|
| 148 |
|
|
| 149 |
v
|
| 150 |
+
[REAL Search] --> PubMed + ClinicalTrials + bioRxiv APIs
|
| 151 |
|
|
| 152 |
v
|
| 153 |
[REAL Embeddings] --> Actual sentence-transformers
|
examples/full_stack_demo/run_full.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
Demo: Full Stack DeepCritical Agent (Phases 1-8).
|
| 4 |
|
| 5 |
This script demonstrates the COMPLETE REAL drug repurposing research pipeline:
|
| 6 |
-
- Phase 2: REAL Search (PubMed
|
| 7 |
- Phase 6: REAL Embeddings (sentence-transformers + ChromaDB)
|
| 8 |
- Phase 7: REAL Hypothesis (LLM mechanistic reasoning)
|
| 9 |
- Phase 3: REAL Judge (LLM evidence assessment)
|
|
@@ -116,13 +116,17 @@ async def run_full_demo(query: str, max_iterations: int) -> None:
|
|
| 116 |
from src.agents.hypothesis_agent import HypothesisAgent
|
| 117 |
from src.agents.report_agent import ReportAgent
|
| 118 |
from src.services.embeddings import EmbeddingService
|
|
|
|
|
|
|
| 119 |
from src.tools.pubmed import PubMedTool
|
| 120 |
from src.tools.search_handler import SearchHandler
|
| 121 |
|
| 122 |
# Initialize REAL services
|
| 123 |
print("[Init] Loading embedding model...")
|
| 124 |
embedding_service = EmbeddingService()
|
| 125 |
-
search_handler = SearchHandler(
|
|
|
|
|
|
|
| 126 |
judge_handler = JudgeHandler()
|
| 127 |
|
| 128 |
# Shared evidence store
|
|
@@ -133,7 +137,7 @@ async def run_full_demo(query: str, max_iterations: int) -> None:
|
|
| 133 |
print_step(iteration, f"ITERATION {iteration}/{max_iterations}")
|
| 134 |
|
| 135 |
# Step 1: REAL Search
|
| 136 |
-
print("\n[Search] Querying PubMed (REAL API calls)...")
|
| 137 |
all_evidence = await _run_search_iteration(
|
| 138 |
query, iteration, evidence_store, all_evidence, search_handler, embedding_service
|
| 139 |
)
|
|
@@ -223,7 +227,7 @@ Examples:
|
|
| 223 |
print(" DeepCritical Full Stack Demo Complete!")
|
| 224 |
print(" ")
|
| 225 |
print(" Everything you just saw was REAL:")
|
| 226 |
-
print(" - Real PubMed searches")
|
| 227 |
print(" - Real embedding computations")
|
| 228 |
print(" - Real LLM reasoning")
|
| 229 |
print(" - Real scientific report")
|
|
|
|
| 3 |
Demo: Full Stack DeepCritical Agent (Phases 1-8).
|
| 4 |
|
| 5 |
This script demonstrates the COMPLETE REAL drug repurposing research pipeline:
|
| 6 |
+
- Phase 2: REAL Search (PubMed + ClinicalTrials + bioRxiv)
|
| 7 |
- Phase 6: REAL Embeddings (sentence-transformers + ChromaDB)
|
| 8 |
- Phase 7: REAL Hypothesis (LLM mechanistic reasoning)
|
| 9 |
- Phase 3: REAL Judge (LLM evidence assessment)
|
|
|
|
| 116 |
from src.agents.hypothesis_agent import HypothesisAgent
|
| 117 |
from src.agents.report_agent import ReportAgent
|
| 118 |
from src.services.embeddings import EmbeddingService
|
| 119 |
+
from src.tools.biorxiv import BioRxivTool
|
| 120 |
+
from src.tools.clinicaltrials import ClinicalTrialsTool
|
| 121 |
from src.tools.pubmed import PubMedTool
|
| 122 |
from src.tools.search_handler import SearchHandler
|
| 123 |
|
| 124 |
# Initialize REAL services
|
| 125 |
print("[Init] Loading embedding model...")
|
| 126 |
embedding_service = EmbeddingService()
|
| 127 |
+
search_handler = SearchHandler(
|
| 128 |
+
tools=[PubMedTool(), ClinicalTrialsTool(), BioRxivTool()], timeout=30.0
|
| 129 |
+
)
|
| 130 |
judge_handler = JudgeHandler()
|
| 131 |
|
| 132 |
# Shared evidence store
|
|
|
|
| 137 |
print_step(iteration, f"ITERATION {iteration}/{max_iterations}")
|
| 138 |
|
| 139 |
# Step 1: REAL Search
|
| 140 |
+
print("\n[Search] Querying PubMed + ClinicalTrials + bioRxiv (REAL API calls)...")
|
| 141 |
all_evidence = await _run_search_iteration(
|
| 142 |
query, iteration, evidence_store, all_evidence, search_handler, embedding_service
|
| 143 |
)
|
|
|
|
| 227 |
print(" DeepCritical Full Stack Demo Complete!")
|
| 228 |
print(" ")
|
| 229 |
print(" Everything you just saw was REAL:")
|
| 230 |
+
print(" - Real PubMed + ClinicalTrials + bioRxiv searches")
|
| 231 |
print(" - Real embedding computations")
|
| 232 |
print(" - Real LLM reasoning")
|
| 233 |
print(" - Real scientific report")
|
examples/hypothesis_demo/run_hypothesis.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
Demo: Hypothesis Generation (Phase 7).
|
| 4 |
|
| 5 |
This script demonstrates the REAL hypothesis generation pipeline:
|
| 6 |
-
1. REAL search: PubMed (actual API calls)
|
| 7 |
2. REAL embeddings: Semantic deduplication
|
| 8 |
3. REAL LLM: Mechanistic hypothesis generation
|
| 9 |
|
|
@@ -21,6 +21,8 @@ from typing import Any
|
|
| 21 |
|
| 22 |
from src.agents.hypothesis_agent import HypothesisAgent
|
| 23 |
from src.services.embeddings import EmbeddingService
|
|
|
|
|
|
|
| 24 |
from src.tools.pubmed import PubMedTool
|
| 25 |
from src.tools.search_handler import SearchHandler
|
| 26 |
|
|
@@ -35,8 +37,10 @@ async def run_hypothesis_demo(query: str) -> None:
|
|
| 35 |
print(f"{'='*60}\n")
|
| 36 |
|
| 37 |
# Step 1: REAL Search
|
| 38 |
-
print("[Step 1] Searching PubMed...")
|
| 39 |
-
search_handler = SearchHandler(
|
|
|
|
|
|
|
| 40 |
result = await search_handler.execute(query, max_results_per_tool=5)
|
| 41 |
|
| 42 |
print(f" Found {result.total_found} results from {result.sources_searched}")
|
|
@@ -128,7 +132,7 @@ Examples:
|
|
| 128 |
|
| 129 |
print("\n" + "=" * 60)
|
| 130 |
print("Demo complete! This was a REAL pipeline:")
|
| 131 |
-
print(" 1. REAL search:
|
| 132 |
print(" 2. REAL embeddings: Actual sentence-transformers")
|
| 133 |
print(" 3. REAL LLM: Actual hypothesis generation")
|
| 134 |
print("=" * 60 + "\n")
|
|
|
|
| 3 |
Demo: Hypothesis Generation (Phase 7).
|
| 4 |
|
| 5 |
This script demonstrates the REAL hypothesis generation pipeline:
|
| 6 |
+
1. REAL search: PubMed + ClinicalTrials + bioRxiv (actual API calls)
|
| 7 |
2. REAL embeddings: Semantic deduplication
|
| 8 |
3. REAL LLM: Mechanistic hypothesis generation
|
| 9 |
|
|
|
|
| 21 |
|
| 22 |
from src.agents.hypothesis_agent import HypothesisAgent
|
| 23 |
from src.services.embeddings import EmbeddingService
|
| 24 |
+
from src.tools.biorxiv import BioRxivTool
|
| 25 |
+
from src.tools.clinicaltrials import ClinicalTrialsTool
|
| 26 |
from src.tools.pubmed import PubMedTool
|
| 27 |
from src.tools.search_handler import SearchHandler
|
| 28 |
|
|
|
|
| 37 |
print(f"{'='*60}\n")
|
| 38 |
|
| 39 |
# Step 1: REAL Search
|
| 40 |
+
print("[Step 1] Searching PubMed + ClinicalTrials + bioRxiv...")
|
| 41 |
+
search_handler = SearchHandler(
|
| 42 |
+
tools=[PubMedTool(), ClinicalTrialsTool(), BioRxivTool()], timeout=30.0
|
| 43 |
+
)
|
| 44 |
result = await search_handler.execute(query, max_results_per_tool=5)
|
| 45 |
|
| 46 |
print(f" Found {result.total_found} results from {result.sources_searched}")
|
|
|
|
| 132 |
|
| 133 |
print("\n" + "=" * 60)
|
| 134 |
print("Demo complete! This was a REAL pipeline:")
|
| 135 |
+
print(" 1. REAL search: PubMed + ClinicalTrials + bioRxiv APIs")
|
| 136 |
print(" 2. REAL embeddings: Actual sentence-transformers")
|
| 137 |
print(" 3. REAL LLM: Actual hypothesis generation")
|
| 138 |
print("=" * 60 + "\n")
|
examples/orchestrator_demo/run_agent.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
Demo: DeepCritical Agent Loop (Search + Judge + Orchestrator).
|
| 4 |
|
| 5 |
This script demonstrates the REAL Phase 4 orchestration:
|
| 6 |
-
- REAL Iterative Search (PubMed
|
| 7 |
- REAL Evidence Evaluation (LLM Judge)
|
| 8 |
- REAL Orchestration Loop
|
| 9 |
- REAL Final Synthesis
|
|
@@ -24,6 +24,8 @@ import sys
|
|
| 24 |
|
| 25 |
from src.agent_factory.judges import JudgeHandler
|
| 26 |
from src.orchestrator import Orchestrator
|
|
|
|
|
|
|
| 27 |
from src.tools.pubmed import PubMedTool
|
| 28 |
from src.tools.search_handler import SearchHandler
|
| 29 |
from src.utils.models import OrchestratorConfig
|
|
@@ -38,7 +40,7 @@ async def main() -> None:
|
|
| 38 |
formatter_class=argparse.RawDescriptionHelpFormatter,
|
| 39 |
epilog="""
|
| 40 |
This demo runs the REAL search-judge-synthesize loop:
|
| 41 |
-
1. REAL search:
|
| 42 |
2. REAL judge: Actual LLM assessing evidence quality
|
| 43 |
3. REAL loop: Actual iterative refinement based on LLM decisions
|
| 44 |
4. REAL synthesis: Actual research summary generation
|
|
@@ -77,7 +79,9 @@ Examples:
|
|
| 77 |
print(f"{'='*60}\n")
|
| 78 |
|
| 79 |
# Setup REAL components
|
| 80 |
-
search_handler = SearchHandler(
|
|
|
|
|
|
|
| 81 |
judge_handler = JudgeHandler() # REAL LLM judge
|
| 82 |
|
| 83 |
config = OrchestratorConfig(max_iterations=args.iterations)
|
|
@@ -101,7 +105,7 @@ Examples:
|
|
| 101 |
|
| 102 |
print("\n" + "=" * 60)
|
| 103 |
print("Demo complete! Everything was REAL:")
|
| 104 |
-
print(" - Real PubMed searches")
|
| 105 |
print(" - Real LLM judge decisions")
|
| 106 |
print(" - Real iterative refinement")
|
| 107 |
print("=" * 60 + "\n")
|
|
|
|
| 3 |
Demo: DeepCritical Agent Loop (Search + Judge + Orchestrator).
|
| 4 |
|
| 5 |
This script demonstrates the REAL Phase 4 orchestration:
|
| 6 |
+
- REAL Iterative Search (PubMed + ClinicalTrials + bioRxiv)
|
| 7 |
- REAL Evidence Evaluation (LLM Judge)
|
| 8 |
- REAL Orchestration Loop
|
| 9 |
- REAL Final Synthesis
|
|
|
|
| 24 |
|
| 25 |
from src.agent_factory.judges import JudgeHandler
|
| 26 |
from src.orchestrator import Orchestrator
|
| 27 |
+
from src.tools.biorxiv import BioRxivTool
|
| 28 |
+
from src.tools.clinicaltrials import ClinicalTrialsTool
|
| 29 |
from src.tools.pubmed import PubMedTool
|
| 30 |
from src.tools.search_handler import SearchHandler
|
| 31 |
from src.utils.models import OrchestratorConfig
|
|
|
|
| 40 |
formatter_class=argparse.RawDescriptionHelpFormatter,
|
| 41 |
epilog="""
|
| 42 |
This demo runs the REAL search-judge-synthesize loop:
|
| 43 |
+
1. REAL search: PubMed + ClinicalTrials + bioRxiv queries
|
| 44 |
2. REAL judge: Actual LLM assessing evidence quality
|
| 45 |
3. REAL loop: Actual iterative refinement based on LLM decisions
|
| 46 |
4. REAL synthesis: Actual research summary generation
|
|
|
|
| 79 |
print(f"{'='*60}\n")
|
| 80 |
|
| 81 |
# Setup REAL components
|
| 82 |
+
search_handler = SearchHandler(
|
| 83 |
+
tools=[PubMedTool(), ClinicalTrialsTool(), BioRxivTool()], timeout=30.0
|
| 84 |
+
)
|
| 85 |
judge_handler = JudgeHandler() # REAL LLM judge
|
| 86 |
|
| 87 |
config = OrchestratorConfig(max_iterations=args.iterations)
|
|
|
|
| 105 |
|
| 106 |
print("\n" + "=" * 60)
|
| 107 |
print("Demo complete! Everything was REAL:")
|
| 108 |
+
print(" - Real PubMed + ClinicalTrials + bioRxiv searches")
|
| 109 |
print(" - Real LLM judge decisions")
|
| 110 |
print(" - Real iterative refinement")
|
| 111 |
print("=" * 60 + "\n")
|
examples/orchestrator_demo/run_magentic.py
CHANGED
|
@@ -18,6 +18,8 @@ import sys
|
|
| 18 |
|
| 19 |
from src.agent_factory.judges import JudgeHandler
|
| 20 |
from src.orchestrator_factory import create_orchestrator
|
|
|
|
|
|
|
| 21 |
from src.tools.pubmed import PubMedTool
|
| 22 |
from src.tools.search_handler import SearchHandler
|
| 23 |
from src.utils.models import OrchestratorConfig
|
|
@@ -42,7 +44,9 @@ async def main() -> None:
|
|
| 42 |
print(f"{ '='*60}\n")
|
| 43 |
|
| 44 |
# 1. Setup Search Tools
|
| 45 |
-
search_handler = SearchHandler(
|
|
|
|
|
|
|
| 46 |
|
| 47 |
# 2. Setup Judge
|
| 48 |
judge_handler = JudgeHandler()
|
|
|
|
| 18 |
|
| 19 |
from src.agent_factory.judges import JudgeHandler
|
| 20 |
from src.orchestrator_factory import create_orchestrator
|
| 21 |
+
from src.tools.biorxiv import BioRxivTool
|
| 22 |
+
from src.tools.clinicaltrials import ClinicalTrialsTool
|
| 23 |
from src.tools.pubmed import PubMedTool
|
| 24 |
from src.tools.search_handler import SearchHandler
|
| 25 |
from src.utils.models import OrchestratorConfig
|
|
|
|
| 44 |
print(f"{ '='*60}\n")
|
| 45 |
|
| 46 |
# 1. Setup Search Tools
|
| 47 |
+
search_handler = SearchHandler(
|
| 48 |
+
tools=[PubMedTool(), ClinicalTrialsTool(), BioRxivTool()], timeout=30.0
|
| 49 |
+
)
|
| 50 |
|
| 51 |
# 2. Setup Judge
|
| 52 |
judge_handler = JudgeHandler()
|