Spaces:
Build error
Build error
Commit History
-
refactor: address final CodeRabbit feedback
- Fix Windows path escaping in verify_sandbox.py using .as_posix() - Improve verdict detection with robust regex matching (avoid false positives) - Wire allow_network parameter to Modal sandbox block_network - Add finally block for sandbox resource cleanup - Use lru_cache for thread-safe singleton pattern - Add OpenAI-only note to LlamaIndexRAGService docstringb50fffd -
fix(rag): address remaining CodeRabbit feedback
- Validate OPENAI_API_KEY before creating LLM/embedding instances - Re-raise exceptions in retrieve() instead of returning empty list - Re-raise exceptions in query() instead of returning error string2f0030b -
refactor: address CodeRabbit review feedback for Mario integration
CRITICAL fix: - Centralize sandbox library versions (SANDBOX_LIBRARIES constant) - Use shared config for both Modal image and LLM prompts - Prevent version mismatch between generated code and execution MAJOR fixes: - Use run_in_executor() for blocking Modal calls in async context - Lazy initialize code executor to avoid failing on import - Remove redundant hypothesis check (unreachable code) - Simplify semantic search placeholder (dead code paths) Minor fixes: - Update docs: Docker → Modal Sandbox terminology - Fix docstring claiming ConfigurationError (only warns)cbd94a4 -
fix(rag): use get_content() for BaseNode compatibility
3f90da8 -
fix(rag): apply lazy imports and use centralized config
- Remove unused TYPE_CHECKING block (imports are in __init__) - Use settings.openai_model instead of hard-coded "gpt-4o-mini" - Fix line length in clear_collection() method - Change Document type hint to Any for lazy import compatibility055a3a7 -
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 -
Merge pull request #15 from The-Obstacle-Is-The-Way/feat/phase10-clinicaltrials
Unverified signaturefeat: Phase 10 - ClinicalTrials.gov Integration17bd211 -
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 -
chore: Update httpx dependency and remove unused extras in pyproject.toml and uv.lock
- Changed httpx dependency to remove the http2 extra, now specifying only the base package. - Updated comments in dependencies to clarify usage for PubMed and ClinicalTrials.gov. - Removed unused package entries for h2, hpack, and hyperframe from uv.lock to streamline dependencies.1efef06 -
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
-
feat(docs): update implementation roadmap and add specs for Phases 9-11
- Updated the implementation roadmap to reflect the completion of Phases 1-8. - Added detailed specifications for Phase 9: Remove DuckDuckGo, Phase 10: ClinicalTrials.gov Integration, and Phase 11: bioRxiv Preprint Integration. - Enhanced the status section to indicate the completion of Phases 1-8 and readiness for Phases 9-11.3fcd8e7 -
Merge pull request #13 from The-Obstacle-Is-The-Way/dev
feat(examples): Phase 6-8 demos for full stack demonstration388cd05 -
fix(report): add explicit JSON structure guidance in prompt
The LLM was returning incorrect JSON structures: - hypotheses_tested: dict instead of list - references: string URLs instead of list of dicts Added explicit format examples in SYSTEM_PROMPT to guide the LLM to produce valid structured output that passes Pydantic validation. This fixes the full_stack_demo ReportAgent validation errors.d01e70d -
refactor(examples): apply CodeRabbit feedback (validations, complexity, formatting)
cd11dad -
refactor(examples): purge all mocks - real API calls only
NO MOCKS. NO FAKE DATA. REAL SCIENCE. Changes: - hypothesis_demo: Now does REAL search before hypothesis generation - full_stack_demo: Removed run_mock_demo(), create_mock_*() functions - orchestrator_demo: Removed --mock flag and MockJudgeHandler - README: Updated to reflect "Real or Nothing" philosophy All examples now require API keys and make real API calls. Mocks belong in tests/unit/, not in demos.cfb473d -
feat(examples): add Phase 6-8 demos for full stack demonstration
- Add embeddings_demo: semantic search & deduplication (no API keys) - Add hypothesis_demo: mechanistic reasoning (requires LLM) - Add full_stack_demo: complete pipeline with mock and real modes - Update examples README with comprehensive documentation Examples demonstrate: - Text embedding with sentence-transformers - ChromaDB vector storage and similarity search - Semantic deduplication by meaning - Drug -> Target -> Pathway -> Effect hypothesis generation - Structured scientific report generation0efdc2f -
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 -
Merge pull request #11 from The-Obstacle-Is-The-Way/feat/phase7-hypothesis-agent
feat(phase7): Hypothesis Agent for mechanistic reasoninge993253 -
fix: mock get_model in tests to avoid API key requirement in CI
ebc6429 -
fix: address CodeRabbit Phase 7 nitpicks
- Add truncation helper to avoid ellipsis on short messages - Verify query and evidence args in test_hypothesis_agenta6398e4 -
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 -
Merge pull request #10 from The-Obstacle-Is-The-Way/feat/phase6-embeddings
feat(phase6): Embeddings & Semantic Searchb25ffdb -
fix: address CodeRabbit Phase 6 review feedback
- Dockerfile: Add curl for HEALTHCHECK, use specific extras (not --all-extras) - app.py: Tighten Magentic mode key detection to require OpenAI specifically - embeddings.py: Move structlog import to module level - test_embeddings.py: Remove redundant numpy import506a9c0 -
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(phase6): critical fixes from senior audit
- Fix Dockerfile cache ownership (run model download as appuser) - Store full citation metadata in vector DB (title, date, authors) - Remove fragile locals() hack in search_agent.py - Add try/except in deduplicate loop for resilience - Document threshold semantics (cosine distance math) - Clean up redundant list() calls59afc84 -
feat(phase6): Embeddings & Semantic Search implementation
- Added EmbeddingService with ChromaDB and SentenceTransformers - Updated SearchAgent to support semantic deduplication and search - Updated MagenticOrchestrator to use embeddings if available - Added 100% async-safe implementation with run_in_executor - Added comprehensive unit tests3bacbf8 -
Merge main: Phase 5 + Phase 6-8 doc revisions
24a5878 -
docs: comprehensive Phase 6-8 spec revisions (Senior Architect audit)
Phase 6 (Embeddings): - Add async/executor pattern for all embedding methods - Add HuggingFace Spaces deployment notes for model caching - Update tests to be async Phase 7 (Hypothesis): - Add text utilities: truncate_at_sentence(), select_diverse_evidence() - Replace arbitrary evidence[:10] with MMR (Maximal Marginal Relevance) - Sentence-boundary-aware truncation Phase 8 (Report) - CRITICAL: - Add citation validation to prevent LLM hallucination - Add validate_references() function spec - Update SYSTEM_PROMPT with strict citation requirements - Add comprehensive citation validation tests All changes address issues identified in the "Senior Architect" audit: - Event loop blocking from sync sentence-transformers - Arbitrary truncation losing important evidence - Hallucinated citations in medical research reportsec3d7dc -
feat(architecture): update system design and roadmap for Phases 1-8
- Revised high-level design to include detailed phases and components of the Magentic system. - Introduced new agents: Magentic Manager, SearchAgent, HypothesisAgent, JudgeAgent, and ReportAgent, each with specific roles in the research process. - Updated success criteria to reflect completion of Phases 1-5 and outlined specifications for Phases 6-8. - Enhanced documentation for clarity on system architecture and agent interactions.2dc022a -
feat(phase8): implement Report Agent for structured scientific report generation
- Introduced `ReportAgent` to generate comprehensive research reports from evidence and hypotheses. - Added `ResearchReport` model with sections for executive summary, methodology, findings, limitations, and references. - Updated MagenticOrchestrator to include ReportAgent as the final synthesis step in the workflow. - Implemented report generation flow and markdown rendering for output. - Added unit tests to ensure functionality of ReportAgent and report generation process.2763672 -
feat(phase6): implement embeddings for semantic search and deduplication
- Introduced `EmbeddingService` for handling text embeddings using ChromaDB. - Updated `SearchAgent` to utilize embeddings for deduplication and semantic search. - Enhanced the MagenticOrchestrator to support embedding-driven queries. - Added comprehensive unit tests for the new embedding functionality. - Improved search capabilities by allowing retrieval of semantically related evidence.53bf395 -
fix(ci): add E402/RUF100 to ignore for cross-env compatibility
- Add E402 to global ignore (pytest.importorskip pattern) - Add RUF100 to global ignore (ruff version differences) - Remove now-unnecessary noqa commentsecbc47b -
fix(ci): skip agent tests when agent-framework not installed
- Remove uv.sources that references local-only reference_repos - Add pytest.importorskip to agent wrapper tests - CI will skip 7 agent tests, run remaining 31 tests5a82171 -
fix(phase5): align configs and add agent tests
- Add PLR0912, PLC0415 to ruff ignore list for complex orchestrator logic - Disable warn_unused_ignores in mypy (vendored lib needs type: ignore) - Fix single ChatMessage input handling in SearchAgent/JudgeAgent - Add comprehensive unit tests for SearchAgent and JudgeAgent wrappers - All 38 tests pass, lint and mypy clean, pre-commit aligned15459e9 -
chore: vendor agent-framework for deployment (fix pre-commit)
7057335 -
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 -
Merge pull request #7 from The-Obstacle-Is-The-Way/feat/phase4
feat(phase4): Orchestrator & UI Complete35ebd09 -
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 -
fix: add type ignore comment for Agent instantiation in JudgeHandler
Updated the Agent instantiation in JudgeHandler to include a type ignore comment, addressing type-checking issues while maintaining functionality.9760706 -
fix(tests): resolve mypy divergence and test failures
- Add pydantic-ai to pre-commit mypy dependencies to fix divergence between local mypy and CI (both now recognize Agent overloads) - Fix JudgeHandler tests to mock get_model() which instantiates OpenAIModel at import time (requires API key)95d2e29 -
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 -
fix(phase2): address CodeRabbit review feedback + add examples
CodeRabbit fixes: - Fix deprecated asyncio.get_event_loop() → get_running_loop() - Remove dead flatten() function from search_handler.py - Remove redundant getattr() in pubmed.py - Add truncation rationale comments New: - Add examples/search_demo/ with run_search.py demo script - Add examples/README.md32e3b61 -
ci: add GitHub Actions workflow for CI/CD
Runs on push/PR to main and dev branches: - Lint with ruff - Type check with mypy - Run unit tests with pytest Uses uv for fast dependency installation.572b569 -
feat(phase2): add sample_evidence fixture to conftest.py
Now that models.py exists (Phase 2 complete), enable the sample_evidence fixture for use in Phase 3 judge tests.2457ae0