File size: 12,995 Bytes
59ce7b1 c7a2e77 59ce7b1 c7a2e77 59ce7b1 |
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 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 |
# Component Inventory
> **Last Updated**: 2025-12-06
This document provides a complete catalog of all components in the DeepBoner codebase.
## Source Code Statistics
| Category | Count |
|----------|-------|
| Python files in `src/` | ~67 |
| Python files in `tests/` | ~76 |
| Total modules | ~143 |
## Directory Structure
```
src/
βββ app.py # Gradio UI entry point
βββ mcp_tools.py # MCP server tool wrappers
βββ orchestrators/ # Research orchestration
βββ clients/ # LLM backend adapters
βββ agents/ # Multi-agent components
βββ agent_factory/ # Agent creation
βββ tools/ # Search tool implementations
βββ services/ # Cross-cutting services
βββ prompts/ # LLM prompt templates
βββ utils/ # Shared utilities
βββ config/ # Domain configuration
βββ middleware/ # Processing middleware
βββ state/ # State management
```
---
## Core Entry Points
### `src/app.py`
**Purpose:** Main application entry point
| Component | Type | Description |
|-----------|------|-------------|
| `create_demo()` | Function | Creates Gradio interface |
| `main()` | Function | Application entry point |
**Dependencies:** Gradio, orchestrators, config
### `src/mcp_tools.py`
**Purpose:** MCP (Model Context Protocol) tool wrappers
| Component | Type | Description |
|-----------|------|-------------|
| `search_pubmed()` | Tool | PubMed search wrapper |
| `search_clinical_trials()` | Tool | ClinicalTrials.gov wrapper |
| `search_europepmc()` | Tool | Europe PMC wrapper |
| `search_all_sources()` | Tool | Multi-source search |
---
## Orchestrators (`src/orchestrators/`)
### `advanced.py`
**Purpose:** Main multi-agent orchestrator using Microsoft Agent Framework
| Component | Type | Description |
|-----------|------|-------------|
| `AdvancedOrchestrator` | Class | Primary research orchestrator |
| `run()` | Method | Execute research workflow |
| `_search_phase()` | Method | Search execution |
| `_judge_phase()` | Method | Evidence evaluation |
| `_synthesize_phase()` | Method | Report generation |
**Framework:** Microsoft Agent Framework (agent-framework-core)
### `factory.py`
**Purpose:** Orchestrator selection
| Component | Type | Description |
|-----------|------|-------------|
| `OrchestratorFactory` | Class | Creates appropriate orchestrator |
| `create()` | Method | Factory method |
### `base.py`
**Purpose:** Base orchestrator interface
| Component | Type | Description |
|-----------|------|-------------|
| `BaseOrchestrator` | ABC | Abstract base class |
### `langgraph_orchestrator.py`
**Purpose:** LangGraph-based workflow (experimental)
| Component | Type | Description |
|-----------|------|-------------|
| `LangGraphOrchestrator` | Class | Workflow state machine |
### `hierarchical.py`
**Purpose:** Hierarchical agent coordination
| Component | Type | Description |
|-----------|------|-------------|
| `HierarchicalOrchestrator` | Class | Manager-agent hierarchy |
---
## LLM Clients (`src/clients/`)
### `factory.py`
**Purpose:** Auto-select LLM backend
| Component | Type | Description |
|-----------|------|-------------|
| `get_chat_client()` | Function | Returns appropriate client |
**Selection Logic:**
```python
if settings.has_openai_key:
return OpenAIChatClient()
else:
return HuggingFaceChatClient()
```
### `huggingface.py`
**Purpose:** HuggingFace Inference API adapter
| Component | Type | Description |
|-----------|------|-------------|
| `HuggingFaceChatClient` | Class | Free tier LLM client |
| `chat_completion()` | Method | Generate completion |
**Model:** Qwen 2.5 7B Instruct (free tier)
### `base.py`
**Purpose:** Client interface
| Component | Type | Description |
|-----------|------|-------------|
| `BaseChatClient` | ABC | Client interface |
### `providers.py`
**Purpose:** Provider implementations
### `registry.py`
**Purpose:** Provider registration
---
## Agents (`src/agents/`)
### `search_agent.py`
| Component | Type | Description |
|-----------|------|-------------|
| `SearchAgent` | Class | Evidence gathering agent |
### `judge_agent.py`
| Component | Type | Description |
|-----------|------|-------------|
| `JudgeAgent` | Class | Evidence evaluation |
### `judge_agent_llm.py`
| Component | Type | Description |
|-----------|------|-------------|
| `LLMJudgeAgent` | Class | LLM-based judge implementation |
### `report_agent.py`
| Component | Type | Description |
|-----------|------|-------------|
| `ReportAgent` | Class | Report synthesis |
### `retrieval_agent.py`
| Component | Type | Description |
|-----------|------|-------------|
| `create_retrieval_agent()` | Factory | Creates ChatAgent for web search |
| `search_web` | @ai_function | DuckDuckGo web search tool |
> **Note:** This module is implemented but NOT wired into `magentic_agents.py`. See GitHub issue #134.
### `hypothesis_agent.py`
| Component | Type | Description |
|-----------|------|-------------|
| `HypothesisAgent` | Class | Mechanistic hypothesis generation |
### `magentic_agents.py`
| Component | Type | Description |
|-----------|------|-------------|
| Multi-agent mode | Module | Microsoft Agent Framework integration |
### `state.py`
| Component | Type | Description |
|-----------|------|-------------|
| Agent state models | Module | Shared state definitions |
### `tools.py`
| Component | Type | Description |
|-----------|------|-------------|
| Tool bindings | Module | Agent tool configuration |
---
## Graph Workflow (`src/agents/graph/`)
### `workflow.py`
| Component | Type | Description |
|-----------|------|-------------|
| `create_workflow()` | Function | LangGraph workflow builder |
### `nodes.py`
| Component | Type | Description |
|-----------|------|-------------|
| `search_node()` | Function | Search workflow node |
| `judge_node()` | Function | Judge workflow node |
| `report_node()` | Function | Report workflow node |
### `state.py`
| Component | Type | Description |
|-----------|------|-------------|
| `WorkflowState` | Class | LangGraph state schema |
---
## Agent Factory (`src/agent_factory/`)
### `judges.py`
**Purpose:** Evidence quality judgment
| Component | Type | Description |
|-----------|------|-------------|
| `create_judge()` | Function | Judge agent factory |
| `JudgeResult` | Model | Assessment output |
**Framework:** Pydantic AI
### `agents.py`
| Component | Type | Description |
|-----------|------|-------------|
| Agent creation | Module | Factory functions |
---
## Search Tools (`src/tools/`)
### `pubmed.py`
| Component | Type | Description |
|-----------|------|-------------|
| `PubMedTool` | Class | NCBI E-utilities client |
| `search()` | Method | Execute search |
**API:** PubMed E-utilities (eutils.ncbi.nlm.nih.gov)
### `clinicaltrials.py`
| Component | Type | Description |
|-----------|------|-------------|
| `ClinicalTrialsTool` | Class | ClinicalTrials.gov client |
| `search()` | Method | Execute search |
**API:** ClinicalTrials.gov API (uses `requests` due to WAF blocking httpx)
### `europepmc.py`
| Component | Type | Description |
|-----------|------|-------------|
| `EuropePMCTool` | Class | Europe PMC client |
| `search()` | Method | Execute search |
**API:** Europe PMC API
### `openalex.py`
| Component | Type | Description |
|-----------|------|-------------|
| `OpenAlexTool` | Class | OpenAlex client |
| `search()` | Method | Execute search |
**API:** OpenAlex API
### `search_handler.py`
| Component | Type | Description |
|-----------|------|-------------|
| `SearchHandler` | Class | Scatter-gather orchestration |
| `search_all()` | Method | Parallel multi-source search |
### `query_utils.py`
| Component | Type | Description |
|-----------|------|-------------|
| Query utilities | Module | Query refinement and expansion |
### `rate_limiter.py`
| Component | Type | Description |
|-----------|------|-------------|
| `RateLimiter` | Class | API rate limiting |
### `base.py`
| Component | Type | Description |
|-----------|------|-------------|
| `BaseSearchTool` | ABC | Search tool interface |
### `web_search.py`
| Component | Type | Description |
|-----------|------|-------------|
| `WebSearchTool` | Class | DuckDuckGo integration wrapper |
> **Note:** Used by `search_web` in `retrieval_agent.py`. See GitHub issue #134 for dead code status.
---
## Services (`src/services/`)
### `embeddings.py`
| Component | Type | Description |
|-----------|------|-------------|
| `EmbeddingService` | Class | Local embedding service |
| `embed()` | Method | Generate embeddings |
| `deduplicate()` | Method | Cross-source deduplication |
**Stack:** sentence-transformers + ChromaDB
### `llamaindex_rag.py`
| Component | Type | Description |
|-----------|------|-------------|
| `LlamaIndexRAG` | Class | Premium RAG service |
**Stack:** LlamaIndex + OpenAI embeddings + ChromaDB
### `embedding_protocol.py`
| Component | Type | Description |
|-----------|------|-------------|
| `EmbeddingProtocol` | Protocol | Interface for embedding services |
### `research_memory.py`
| Component | Type | Description |
|-----------|------|-------------|
| `ResearchMemory` | Class | Shared research state |
---
## Utilities (`src/utils/`)
### `config.py`
| Component | Type | Description |
|-----------|------|-------------|
| `Settings` | Class | Pydantic Settings configuration |
| `settings` | Instance | Global settings singleton |
| `get_settings()` | Function | Settings factory |
| `configure_logging()` | Function | Logging setup |
### `models.py`
| Component | Type | Description |
|-----------|------|-------------|
| `Evidence` | Model | Evidence with citation |
| `Citation` | Model | Source citation |
| `SearchResult` | Model | Search response |
| `JudgeAssessment` | Model | Judge evaluation |
| `ResearchReport` | Model | Final report |
| `AgentEvent` | Model | UI streaming events |
See [Data Models](data-models.md) for complete documentation.
### `exceptions.py`
| Component | Type | Description |
|-----------|------|-------------|
| `DeepBonerError` | Exception | Base exception |
| `SearchError` | Exception | Search failures |
| `JudgeError` | Exception | Judge failures |
| `ConfigurationError` | Exception | Config errors |
| `RateLimitError` | Exception | Rate limits |
See [Exception Hierarchy](exception-hierarchy.md) for details.
### `service_loader.py`
| Component | Type | Description |
|-----------|------|-------------|
| Service loading | Module | Tiered service selection |
### `citation_validator.py`
| Component | Type | Description |
|-----------|------|-------------|
| Citation validation | Module | URL verification |
### `text_utils.py`
| Component | Type | Description |
|-----------|------|-------------|
| Text utilities | Module | Text processing |
### `parsers.py`
| Component | Type | Description |
|-----------|------|-------------|
| Response parsing | Module | LLM output parsing |
### `dataloaders.py`
| Component | Type | Description |
|-----------|------|-------------|
| Data loading | Module | Data loading utilities |
---
## Configuration (`src/config/`)
### `domain.py`
| Component | Type | Description |
|-----------|------|-------------|
| `ResearchDomain` | Enum | Research domain types |
---
## Prompts (`src/prompts/`)
| File | Purpose |
|------|---------|
| `search.py` | Query refinement prompts |
| `judge.py` | Evidence assessment prompts |
| `hypothesis.py` | Hypothesis generation prompts |
| `synthesis.py` | Evidence synthesis prompts |
| `report.py` | Report generation prompts |
---
## Middleware (`src/middleware/`)
### `sub_iteration.py`
| Component | Type | Description |
|-----------|------|-------------|
| Sub-iteration | Module | Nested iteration logic |
---
## Reserved Directories
These directories exist but are placeholders for future features:
| Directory | Purpose |
|-----------|---------|
| `src/database_services/` | Future database services |
| `src/retrieval_factory/` | Future retrieval configuration |
---
## Test Structure
```
tests/
βββ conftest.py # Shared fixtures
βββ unit/ # Unit tests (mocked)
β βββ orchestrators/
β βββ agents/
β βββ clients/
β βββ tools/
β βββ services/
β βββ utils/
β βββ prompts/
β βββ agent_factory/
β βββ config/
β βββ graph/
β βββ mcp/
βββ integration/ # Integration tests (real APIs)
βββ e2e/ # End-to-end tests
```
---
## Related Documentation
- [Architecture Overview](overview.md)
- [Data Models](data-models.md)
- [Exception Hierarchy](exception-hierarchy.md)
- [System Registry](system-registry.md)
|