File size: 4,246 Bytes
0efdc2f
32e3b61
cfb473d
0efdc2f
cfb473d
 
 
 
 
 
 
0efdc2f
 
cfb473d
 
 
 
 
 
0efdc2f
cfb473d
 
0efdc2f
 
 
32e3b61
cfb473d
 
 
32e3b61
cfb473d
32e3b61
 
4732667
32e3b61
 
cfb473d
 
 
 
0efdc2f
 
 
cfb473d
4732667
cfb473d
4732667
 
cfb473d
0efdc2f
 
cfb473d
 
 
 
 
0efdc2f
 
 
cfb473d
0efdc2f
cfb473d
0efdc2f
 
cfb473d
 
0efdc2f
 
cfb473d
 
 
 
 
0efdc2f
 
 
cfb473d
0efdc2f
cfb473d
0efdc2f
 
cfb473d
 
0efdc2f
 
cfb473d
 
 
 
0efdc2f
 
 
cfb473d
0efdc2f
cfb473d
0efdc2f
 
 
 
 
 
cfb473d
 
 
 
 
0efdc2f
 
 
cd11dad
0efdc2f
cfb473d
0efdc2f
 
 
 
 
 
cfb473d
 
 
 
 
 
 
 
0efdc2f
 
 
cfb473d
0efdc2f
cfb473d
 
 
 
 
 
 
 
0efdc2f
 
 
cfb473d
0efdc2f
cd11dad
0efdc2f
 
 
cfb473d
0efdc2f
 
cfb473d
0efdc2f
 
cfb473d
0efdc2f
 
cfb473d
0efdc2f
cfb473d
0efdc2f
cfb473d
0efdc2f
 
cfb473d
0efdc2f
 
cfb473d
0efdc2f
cfb473d
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# DeepCritical Examples

**NO MOCKS. NO FAKE DATA. REAL SCIENCE.**

These demos run the REAL drug repurposing research pipeline with actual API calls.

---

## Prerequisites

You MUST have API keys configured:

```bash
# Copy the example and add your keys
cp .env.example .env

# Required (pick one):
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...

# Optional (higher PubMed rate limits):
NCBI_API_KEY=your-key
```

---

## Examples

### 1. Search Demo (No LLM Required)

Demonstrates REAL parallel search across PubMed and Web.

```bash
uv run python examples/search_demo/run_search.py "metformin cancer"
```

**What's REAL:**
- Actual NCBI E-utilities API calls
- Actual DuckDuckGo web searches
- Real papers, real URLs, real content

---

### 2. Embeddings Demo (No LLM Required)

Demonstrates REAL semantic search and deduplication.

```bash
uv run python examples/embeddings_demo/run_embeddings.py
```

**What's REAL:**
- Actual sentence-transformers model (all-MiniLM-L6-v2)
- Actual ChromaDB vector storage
- Real cosine similarity computations
- Real semantic deduplication

---

### 3. Orchestrator Demo (LLM Required)

Demonstrates the REAL search-judge-synthesize loop.

```bash
uv run python examples/orchestrator_demo/run_agent.py "metformin cancer"
uv run python examples/orchestrator_demo/run_agent.py "aspirin alzheimer" --iterations 5
```

**What's REAL:**
- Real PubMed + Web searches
- Real LLM judge evaluating evidence quality
- Real iterative refinement based on LLM decisions
- Real research synthesis

---

### 4. Magentic Demo (OpenAI Required)

Demonstrates REAL multi-agent coordination using Microsoft Agent Framework.

```bash
# Requires OPENAI_API_KEY specifically
uv run python examples/orchestrator_demo/run_magentic.py "metformin cancer"
```

**What's REAL:**
- Real MagenticBuilder orchestration
- Real SearchAgent, JudgeAgent, HypothesisAgent, ReportAgent
- Real manager-based coordination

---

### 5. Hypothesis Demo (LLM Required)

Demonstrates REAL mechanistic hypothesis generation.

```bash
uv run python examples/hypothesis_demo/run_hypothesis.py "metformin Alzheimer's"
uv run python examples/hypothesis_demo/run_hypothesis.py "sildenafil heart failure"
```

**What's REAL:**
- Real PubMed + Web search first
- Real embedding-based deduplication
- Real LLM generating Drug -> Target -> Pathway -> Effect chains
- Real knowledge gap identification

---

### 6. Full-Stack Demo (LLM Required)

**THE COMPLETE PIPELINE** - All phases working together.

```bash
uv run python examples/full_stack_demo/run_full.py "metformin Alzheimer's"
uv run python examples/full_stack_demo/run_full.py "sildenafil heart failure" -i 3
```

**What's REAL:**
1. Real PubMed + Web evidence collection
2. Real embedding-based semantic deduplication
3. Real LLM mechanistic hypothesis generation
4. Real LLM evidence quality assessment
5. Real LLM structured scientific report generation

Output: Publication-quality research report with validated citations.

---

## API Key Requirements

| Example | LLM Required | Keys |
|---------|--------------|------|
| search_demo | No | Optional: `NCBI_API_KEY` |
| embeddings_demo | No | None |
| orchestrator_demo | Yes | `OPENAI_API_KEY` or `ANTHROPIC_API_KEY` |
| run_magentic | Yes | `OPENAI_API_KEY` (Magentic requires OpenAI) |
| hypothesis_demo | Yes | `OPENAI_API_KEY` or `ANTHROPIC_API_KEY` |
| full_stack_demo | Yes | `OPENAI_API_KEY` or `ANTHROPIC_API_KEY` |

---

## Architecture

```text
User Query
    |
    v
[REAL Search] --> Actual PubMed + Web API calls
    |
    v
[REAL Embeddings] --> Actual sentence-transformers
    |
    v
[REAL Hypothesis] --> Actual LLM reasoning
    |
    v
[REAL Judge] --> Actual LLM assessment
    |
    +---> Need more? --> Loop back to Search
    |
    +---> Sufficient --> Continue
    |
    v
[REAL Report] --> Actual LLM synthesis
    |
    v
Publication-Quality Research Report
```

---

## Why No Mocks?

> "Authenticity is the feature."

Mocks belong in `tests/unit/`, not in demos. When you run these examples, you see:
- Real papers from real databases
- Real AI reasoning about real evidence
- Real scientific hypotheses
- Real research reports

This is what DeepCritical actually does. No fake data. No canned responses.