Spaces:
Sleeping
Sleeping
Commit History
-
fix: P0 provider mismatch and code quality audit fixes (#102)
Unverified signature* refactor: replace hacky try/except with proper pydantic validation PROBLEM: - CodeRabbit recommended try/except for ADVANCED_MAX_ROUNDS parsing - This is hacky defensive programming, not Clean Code - Silent fallbacks mask configuration errors SOLUTION (Uncle Bob approved): 1. Add advanced_max_rounds to Settings with pydantic Field validation: - ge=1, le=20 bounds checking - Fails fast at startup with clear error message 2. Add advanced_timeout to Settings (60-900 seconds) 3. Remove os.getenv + try/except hack from advanced.py - Now uses settings.advanced_max_rounds directly 4. Fix domain.py: invalid domain strings now raise ValueError - Shows valid options in error message - Previously silently fell back to default 5. Update tests: 18 tests verifying fail-fast behavior - TestSettingsValidation: type errors, bounds violations all raise - TestGetDomainConfig: invalid strings raise with helpful message PHILOSOPHY: "If someone configures your app wrong, tell t…599a754 -
fix(SPEC_11): address CodeRabbit review feedback (#92)
Unverified signature* fix(SPEC_11): address CodeRabbit review feedback - Update run_full.py docstring to reference sexual health pipeline (not drug repurposing) - Update run_full.py help text to use sexual health query example - Fix app.py domain display to show "Sexual Health" (not "Sexual_Health") - Update test_nodes.py mock data to use sexual health terms (Testosterone, Androgen Receptor) - Add @pytest.mark.unit markers to test_judges.py test classes - Add specific assertion for next_search_queries in test_judges.py - Add missing @pytest.mark.asyncio marker to test_mcp_tools.py - Update test_mcp_tools.py and test_clinicaltrials.py to use sexual health queries - Fix SPEC_12 markdown bare code fence (MD040) * fix(SPEC_11): comprehensive domain alignment audit Second pass of CodeRabbit review fixes - found additional domain mismatches: - examples/search_demo/run_search.py: Update docstring from "drug repurposing" to "sexual health" - examples/orchestrator_demo/run_agent.py: Update help text from "metf…89f1173 -
feat(SPEC_11): narrow scope to sexual health only
BREAKING CHANGE: Remove GENERAL and DRUG_REPURPOSING domains DeepBoner is now a focused Sexual Health Research Specialist, not a general-purpose research agent. Changes: - Remove ResearchDomain.GENERAL and ResearchDomain.DRUG_REPURPOSING - Remove GENERAL_CONFIG and DRUG_REPURPOSING_CONFIG from domain.py - Set DEFAULT_DOMAIN = ResearchDomain.SEXUAL_HEALTH - Update Gradio examples (remove Metformin/Alzheimer's) - New example: "Testosterone therapy for hypoactive sexual desire disorder?" - Hide domain dropdown (only one option now) - Update all domain-related tests Closes #89627c291 -
feat: SPEC_10 - Domain-Agnostic Refactor + License Fix (#87)
Unverified signature* feat: implement SPEC_10 domain-agnostic refactor * fix: complete SPEC_10 audit - license + HierarchicalOrchestrator domain License Fixes: - LICENSE: Fix copyright "Antibody Training Pipeline ESM" → "DeepBoner Contributors" - pyproject.toml: Add missing license = "Apache-2.0" field - README.md: Fix frontmatter license: mit → apache-2.0 Domain Threading Fixes: - hierarchical.py: Add domain param to __init__ and pass to ResearchTeam - factory.py: Pass domain to HierarchicalOrchestrator All 237 tests pass. Domain now properly threaded through all orchestrators. * test: enhance domain handling in orchestrators and judges - Updated unit tests for `configure_orchestrator` to include mock mode and free tier scenarios, ensuring the domain is correctly passed to handlers. - Refactored tests for `JudgeHandler` to mock model retrieval, allowing for domain acceptance without API key requirements. - Improved `AdvancedOrchestrator` tests to mock API key validation and ensure domain handling i…fd1472e -
feat: Wire LlamaIndex RAG into Simple Mode (Tiered Embedding) (#83)
Unverified signature* feat: wire LlamaIndex RAG service into embedding infrastructure This PR implements tiered embedding service selection per NEXT_TASK.md: ## Changes - Add EmbeddingServiceProtocol (embedding_protocol.py) for unified interface - Add async wrappers to LlamaIndexRAGService (add_evidence, search_similar, deduplicate) - Update service_loader.py with get_embedding_service() factory method - Update ResearchMemory to use service_loader instead of direct EmbeddingService - Update orchestrators to use EmbeddingServiceProtocol type hints ## Design Patterns Applied - Strategy Pattern: Tiered service selection (LlamaIndex or local) - Factory Method: get_embedding_service() creates appropriate service - Protocol Pattern: Structural typing for service interface - Dependency Injection: ResearchMemory accepts any protocol-compatible service ## Tiered Selection - Premium tier (OPENAI_API_KEY present): LlamaIndexRAGService with: - OpenAI embeddings (text-embedding-3-small) - Persistent ChromaDB s…7baf8ba
-
feat: add service loader + SPEC_06 + P0 bug report
Service Loader: - Create src/utils/service_loader.py for centralized lazy loading - All orchestrators now use centralized service loading - Enforces OrchestratorProtocol on Advanced and Hierarchical SPEC_06 (Simple Mode Synthesis - not yet implemented): - Research-backed spec for fixing Simple mode never synthesizing - Identifies 6 root causes with November 2025 LLM-as-Judge research - Separates scoring from decision-making (debiased architecture) P0 Bug Report: - Documents Simple mode producing only citations (no synthesis) - Confidence dropping to 0% in late iterations (context overflow) - Judge never recommending "synthesize" even with 455 sources CodeRabbit concerns from PR #70 addressed.9639483 -
fix: implement SPEC_04 (Magentic UX) and SPEC_05 (cleanup)
SPEC_04: - P0: Preserve chat history on timeout (app.py) - P1: Increase default timeout to 600s - P1: Add MAGENTIC_TIMEOUT env var config SPEC_05: - Delete empty src/orchestrator/ folder - Delete unused orchestrator_hierarchical.py (0% coverage) All 162 tests pass.cb46aac -
feat: Implement SPEC_01 (Termination) and SPEC_02 (E2E Tests)
- SPEC_01: Added timeout (300s) and progress events to MagenticOrchestrator - SPEC_02: Created tests/e2e/ with mocked tests for Simple and Advanced modes - Docs: Updated specs to match codebase stateb1d094d -
fix: P0/P1/P2 - Gradio crash, UX improvements, thinking state (#61)
Unverified signature* fix: handle None parameters from Gradio example caching (P0) Root cause: Gradio passes None for missing example columns during startup caching, overriding Python default values. Line 131 called .strip() on None, crashing the HuggingFace Space. Fix: Add defensive None handling before .strip(): api_key_str = api_key or "" api_key_state_str = api_key_state or "" Added tests to prevent regression. * fix: multiple UX improvements (P1 bugs) 1. HSDD acronym spelled out (Hypoactive Sexual Desire Disorder) 2. Added loading indicator ("Processing...") for immediate feedback 3. Removed temperature settings from magentic agents for reasoning model compatibility (o3, o1 only support temperature=1) 4. Bug report documenting remaining issues (API key persistence) 140 tests passing. * fix: enhance UX with "thinking" state and API key persistence 1. Added a "thinking" state yield before blocking calls in Magentic orchestrator to improve user feedback during long processing times. 2. Up…6b5e05b -
Merge branch 'dev' - P1 bug fixes + CodeRabbit feedback
8f45b69 -
fix: replace deprecated OpenAIModel with OpenAIChatModel
Update pydantic-ai imports to use OpenAIChatModel instead of the deprecated OpenAIModel class. Also adds Bug 3 (deprecation) and Bug 4 (asyncio GC errors) to the integration bug documentation. Files updated: - src/app.py: Import and type annotation - src/utils/llm_factory.py: Import and usage - docs/bugs/P1_MAGENTIC_STREAMING_AND_KEY_PERSISTENCE.md: Add 2 new bugs All 136 tests pass.c881895 -
fix(config): use gpt-5.1 (actually available) not gpt-5 (deprecated)
75bc69f -
fix: P0 bugs + model config stabilization (November 2025) (#59)
Unverified signature* fix(judges): fallback to heuristic extraction when HF quota exhausted * fix(config): update default LLM models to stable Nov 2025 versions * docs: add LLM model defaults (Nov 2025) to agent guidance files * refactor(judges): extract shared title-extraction helper Address CodeRabbit nitpicks: - Add language tag to fenced code block in docs - Extract _extract_titles_from_evidence() to reduce duplication between HFInferenceJudgeHandler and MockJudgeHandler All 136 tests pass.622c8ba -
fix(config): update default LLM models to stable Nov 2025 versions
bfc953b -
fix: complete audit fixes for documentation accuracy
Code Changes: - Remove DeepCriticalError backwards-compat alias (src/utils/exceptions.py) Documentation Accuracy Fixes: - Update CLAUDE.md, AGENTS.md, GEMINI.md: "Phases 1-13" → "Phases 1-14" - Replace 11_phase_biorxiv.md with 11_phase_europepmc.md (actual implementation) - Fix all bioRxiv → Europe PMC references in: - workflow-diagrams.md (mermaid diagrams) - 05_phase_magentic.md (code examples) - 04_phase_ui.md (imports) - roadmap.md (directory tree, phase list) - index.md (links) All 127 tests still pass. Documentation now accurately reflects codebase.e720905
-
rebrand: DeepCritical → DeepBoner (sexual health research agent)
🍆 AI-Native Sexual Health Research Agent - Package renamed: deepcritical → deepboner - New focus: sexual wellness, ED, hormone therapy, libido, reproductive health - Exception class: DeepCriticalError → DeepBonerError (with backwards compat) - UI examples updated for sexual health queries - Modal app renamed: deepboner-code-execution - Fixed pre-existing mypy issue (Modal API: uv_pip_install → pip_install) 46 files updated across: - Core: pyproject.toml, README.md, CLAUDE.md, AGENTS.md, GEMINI.md - Source: app.py, mcp_tools.py, exceptions.py, code_execution.py - Docs: ~25 markdown files - Examples: 8 demo scripts - Tests: exception tests updated All tests passing (102 passed, 6 skipped)5d12635
-
feat: add hierarchical orchestration with web search (integrates PR #44) (#46)
Unverified signature* feat: add hierarchical orchestration with web search (from PR #44) Based on contribution by @EmployeeNo427 with fixes: New features: - WebSearchTool using DuckDuckGo for web searches - SubIterationMiddleware for research loop pattern - HierarchicalOrchestrator with judge-based refinement - RetrievalAgent for web-based evidence gathering - CodeExecutorAgent for Modal sandbox execution - LLMSubIterationJudge for LLM-based assessment - src/state/ package for state management Fixes applied: - Added chroma_db/ to .gitignore (was committed as binaries) - Added structlog logging per coding guidelines - Added pytest markers to new tests - Fixed silent exception swallowing in orchestrator - Preserved dual-mode architecture from PR #45 - Added "web" to SourceName type - Fixed mypy type errors Co-authored-by: EmployeeNo427 <45109567+EmployeeNo427@users.noreply.github.com> * fix: resolve mypy type errors in middleware and agents * fix: remove type argument from SubIterationTeam --------- …20f762e -
feat: implement dual-mode architecture (Simple + Advanced) (#45)
Unverified signature* docs: add dual-mode architecture specification Senior agent reviewed and approved. Key documents: - 00_SITUATION_AND_PLAN.md: Problem analysis, branch states, recommended path - 01_ARCHITECTURE_SPEC.md: Dual-mode architecture (Simple + Advanced) - 02_IMPLEMENTATION_PHASES.md: 6-phase implementation plan - 03_IMMEDIATE_ACTIONS.md: Quick reference checklist Architecture: pydantic-ai (structured outputs) + Microsoft Agent Framework (orchestration) are COMPLEMENTARY, not competing. Dual-mode allows graceful degradation to free tier when no API keys available. * docs: add follow-up review request for senior agent verification * feat: implement dual-mode architecture (Simple + Advanced) Phase 1 - Pydantic-AI Improvements (Simple Mode): - Add HuggingFace provider support in judges.py with get_model() - Add huggingface_model and hf_token config fields - Tests in test_judges_factory.py Phase 2 - Orchestrator Factory: - Implement create_orchestrator() with auto-detection logic - Simple m…b2929fc -
feat: add roadmap summary and detailed improvement plans for data sources
- Introduced new documentation files outlining the current state and future improvements for DeepCritical's data sources: PubMed, ClinicalTrials.gov, Europe PMC, and OpenAlex. - Each document includes sections on current implementation, strengths, limitations, recommended improvements, and integration opportunities. - Added a comprehensive roadmap summary to guide future maintainers and enhance project maintainability.9286db5 -
fix: address CodeRabbit feedback and CI failure
- Mock check_magentic_requirements in tests to run without OPENAI_API_KEY - Update stale "biorxiv" comment in models.py per CodeRabbit suggestion CI was failing because MagenticOrchestrator requires OPENAI_API_KEY, which exists locally in .env but not in CI environment.2ff16a3 -
fix(magentic): defensive text extraction & cleanup biorxiv refs
Add _extract_text to fix ChatMessage object output bug. Update bioRxiv strings to Europe PMC. Add regression test.3bfd42c -
fix: update references to Europe PMC in examples and documentation
Replaced mentions of bioRxiv with Europe PMC in the full stack and hypothesis demo scripts to reflect the current data sources. Updated the pyproject.toml to exclude specific directories from mypy checks using regex patterns for better clarity.9d21bf8 -
fix(config): increase max iterations to 10
Addressed P0-004 by increasing default max_iterations from 5 to 10 to allow deep search loops to complete successfully.72b2667 -
refactor(tools): replace BioRxiv with Europe PMC (Phase 01)
Replaced broken BioRxivTool with EuropePMCTool which supports keyword search. Updated all agents, MCP tools, and examples to use the new tool. Deleted legacy BioRxiv implementation.2f8ae1f
-
chore: clean up env config and upgrade model defaults
- Remove dead HF_TOKEN from .env.example (not used in codebase) - Remove unused enable_modal_analysis config option - Add missing env vars: LLM_PROVIDER, SEARCH_TIMEOUT, model names - Update default models to latest: gpt-5.1, claude-sonnet-4-5-20250929 - Reorganize .env.example with clear sections - Remove personal attribution comments (group project) All env vars now properly wired end-to-end.9e9bc6b -
fix: make ResearchReport.references optional with default
The LLM doesn't always return the references field, causing validation failures. Adding default_factory=list makes it optional. TDD: Added tests/unit/utils/test_models.py with coverage for this case. Fixes #23f882609 -
refactor: address CodeRabbit nitpick suggestions
- Use Literal type for verdict field (type safety) - Use lru_cache for thread-safe singleton pattern - Fix ellipsis only appended when content is truncated - Clarify docstrings for enable_modal_analysis vs modal_available - Surface execution failures in verify_sandbox.py demo - Gate StatisticalAnalyzer integration test on LLM keys901acc3 -
feat: implement phase 13 modal pipeline integration
7cc8b69 -
feat: Phase 11 bioRxiv Preprint Integration (#19)
Unverified signature* feat: Implement Phase 11 (bioRxiv Preprint Integration) * chore: add .mypy_cache to .gitignore * fix: address CodeRabbit review feedback for bioRxiv tool - Catch httpx.RequestError for network failures (major issue) - Use SourceName type alias in Citation model (DRY) - Only add '...' suffix when abstract is truncated - Add test for network error handlinge67c99f -
refactor: centralize embedding configuration in Settings
- Add openai_embedding_model and local_embedding_model to Settings - Update LlamaIndexRAGService to use settings.openai_embedding_model - Update EmbeddingService to use settings.local_embedding_model - Both services now read from centralized config instead of hardcoding - Constraint (OpenAI-only for cloud embeddings) is now explicit in config20c7bad -
feat: Integrate Mario's Modal code execution + LlamaIndex RAG
Cherry-picked from mario-dev branch: - src/tools/code_execution.py: Modal sandbox for LLM-generated code - src/services/llamaindex_rag.py: LlamaIndex + ChromaDB RAG service - src/agents/analysis_agent.py: Statistical analysis agent - examples/modal_demo/: Demo scripts for code execution - docs/workflow-diagrams.md: Architecture documentation Dependencies added as optional [modal] group: - modal>=0.63.0, llama-index, chromadb Config additions: - MODAL_TOKEN_ID, MODAL_TOKEN_SECRET, CHROMA_DB_PATH Co-authored-by: Mario <mario@contributor>3aa91e9 -
refactor: address CodeRabbit nitpicks for Phase 10
- Centralize SourceName type alias in models.py - Update search_handler.py to use SourceName (reduces cast brittleness) - Update app.py intro text to mention ClinicalTrials.gov - Update run_search.py docstring for multi-source search - DRY test setup with mock_requests_get fixture - Speed up error test by patching tenacity retry stop condition1bc9785 -
feat: Implement Phase 10 (ClinicalTrials.gov) with requests
4e2ccbf -
feat: Complete Phase 9 Source Cleanup (Remove WebTool) (#14)
* feat: complete Phase 9 source cleanup - Removed WebTool (src/tools/websearch.py) and related tests - Updated SearchHandler and models to support only PubMed - Refactored all examples and tests to remove web search dependencies - Added verification tests to ensure no WebTool references remain - Fixed all unit tests to align with strict 'pubmed' source typing * fix: address CodeRabbit review feedback - Deduplicate tenacity dependency in pyproject.toml - Remove 'and web' from search agent description - Normalize Citation source to 'pubmed' in search agent - Update app.py markdown to remove web search references - Update embeddings demo with realistic PubMed URL/author - Enhance SearchHandler tests to verify multi-tool aggregation * refactor: replace mock data with real PubMed data in embeddings demo * fix: address CodeRabbit review feedback - Fix nested test_search_handler_pubmed_only (was inside another test, never ran) - Improve test_no_webtool_references to catch `from src.tool…cd004e1
-
fix: address all CodeRabbit Phase 8 review feedback
Actionable issue: - Forward additional_properties in run_stream for consistent metadata Nitpicks addressed: - Report event now uses actual agent message instead of hardcoded text - Citation validator: documented in-place mutation, use exact title match - Log truncation uses constant _MAX_URL_DISPLAY_LENGTH - Test asserts final_report is stored - Handle empty lists in markdown (hypotheses, drugs, limitations, refs) - Edge case: show "Untested" when supported==contradicted==0 - Document citations field in ReportSection as reserved for future usef1e4e5b -
fix: apply lazy init pattern and pydantic-ai fixes to ReportAgent (#12)
Applies the same fixes as Phase 7 HypothesisAgent: - Lazy initialization via _get_agent() to avoid API key requirement at import - Use output_type instead of result_type (pydantic-ai API) - Use result.output instead of result.data - Fix line length issues in tests - Proper mocking of get_model in tests3139749 -
fix: address CodeRabbit Phase 7 review feedback
- Lazy initialize HypothesisAgent's pydantic-ai Agent to avoid requiring API keys at import time (fixes CI failure) - Add explicit default=None to primary_hypothesis field for Pydantic v2 compliancebc74531 -
feat(phase7): implement Hypothesis Agent for mechanistic reasoning
Add HypothesisAgent that generates Drug → Target → Pathway → Effect hypotheses based on collected evidence. Key features: Models: - MechanismHypothesis: structured hypothesis with confidence scoring - HypothesisAssessment: container for hypotheses with knowledge gaps Utilities: - MMR (Maximal Marginal Relevance) for diverse evidence selection - Sentence-aware truncation for clean text processing Agent: - HypothesisAgent generates 2-4 testable hypotheses per query - Integrated with EmbeddingService for semantic evidence selection Orchestrator: - Refactored MagenticOrchestrator into smaller methods - Added "hypothesizing" event type for UI feedback - Workflow: Search → Hypothesize → Targeted Search → Judge Tests: 53/53 passing, mypy clean, ruff cleanc690006 -
fix: address CodeRabbit Phase 5 review feedback
Critical fixes: - Fix invalid model names (gpt-5.1 → gpt-4o, claude-sonnet-4-5 → claude-sonnet-4-20250514) - Add OpenAI key validation in MagenticOrchestrator with clear error message - Document Magentic mode's OpenAI-only requirement Nitpicks: - Add streaming icon to AgentEvent.to_markdown() - Use exact equality for PubMed placeholder detection - Update app.py info text for API key requirements - Add language identifiers to markdown code blocks in docsd247864 -
fix: linting and types for phase 5
1922dbd -
fix: pass API keys explicitly to pydantic-ai providers
- Use OpenAIProvider and AnthropicProvider with explicit api_key - Removes need for users to source .env or export vars manually - Update default OpenAI model to gpt-5.1 - Frictionless UX: just add keys to .env and run examples1f96735 -
fix: pydantic-ai v1 compatibility and Anthropic model update
- Use result.output instead of deprecated result.data (pydantic-ai v1) - Update Anthropic model to claude-sonnet-4-5 - Remove redundant cast in judges.py - Add orchestrator_demo example for end-to-end testing - Fix NCBI_API_KEY placeholder handling in pubmed.py - Update tests to use .output instead of .data4732667 -
refactor(phase4): address CodeRabbit review
- Pin uv version in Dockerfile and add non-root user - Use OrchestratorConfig for timeout in app.py - Use timezone.utc for timestamps in models.py36983ae -
feat(phase4): Orchestrator and UI complete
25c3a8b -
feat(phase3): implement judge slice (LLM Judge, Prompts, Models)
Implemented LLM-based Judge Agent with PydanticAI for structured output. Includes 100% test coverage and fallback mechanisms.d7e5abb -
feat(phase2): implement search slice (PubMed, Web, Orchestrator) (#4)
Implemented search tools with strict TDD and scatter-gather pattern. 100% test coverage.499170b -
feat(phase1): Foundation & Tooling complete
* feat: initialize deepcritical project structure with core configuration and main functionality - Added initial project files including `.python-version`, `pyproject.toml`, and main application logic in `main.py`. - Implemented application configuration using Pydantic in `src/utils/config.py` with environment variable support. - Created directory structure for source code and tests, including placeholders for agents, prompts, tools, and utilities. - Added unit tests for configuration loading and validation in `tests/unit/utils/test_config.py`. Review Score: 100/100 (Ironclad Gucci Banger Edition) * feat(phase1): complete foundation with Python 3.11, tests, and tooling - Fix Python version to 3.11 for HuggingFace Spaces compatibility - Add config.py with pydantic-settings for typed configuration - Add exceptions.py with custom exception hierarchy - Add conftest.py with test fixtures (sample_evidence deferred to Phase 2) - Add .env.example and .pre-commit-config.yaml - Remove refere…069f0a0
-
adds scaffolding
Joseph Pollack6fbbcda