Builds PaperTrail from the base skeleton into a full evidence-verification platform for the "Built with Claude: Life Sciences" hackathon (Builder Track). New named-user features (Build Beyond the Bench): - Lab Notebook Companion — rough bench notes -> structured, searchable, grounded experiment records (lib/labNotebook, /console/lab-notebook, migration 0059) - Clinical Trial Matcher — de-identified patient notes -> ranked eligible ClinicalTrials.gov trials with per-criterion inclusion/exclusion reasoning (lib/trialMatcher, /console/trial-matcher, migrations 0060) Platform: - Deterministic verification moat (biostats recompute, exact-span grounding) - 11 biomedical evidence engines (FAERS, GWAS, Open Targets, ChEMBL, ClinVar, PharmGKB, PubTator, DDI, repurposing, biomarker, unified verifier) - Evidence Intelligence (KG, dossier, provenance/export, RWE) + enterprise governance (RBAC, /api/v1 gateway, metering, audit chain, retention) - 17 OSS projects assimilated into native TypeScript on our stack (backend/engines retained + credited in NOTICE) - Multi-format upload (PDF/DOCX/XLSX/CSV/MD/TXT), logo, marketing site - Next.js 16 upgrade, benchmark harness (honest smoke-test caveat) Licensing: Apache-2.0 (LICENSE + NOTICE).
47 lines
1.9 KiB
Python
47 lines
1.9 KiB
Python
import unittest
|
|
from unittest.mock import MagicMock, patch, AsyncMock
|
|
import asyncio
|
|
from gpt_researcher.agent import GPTResearcher
|
|
import os
|
|
|
|
class TestQuickSearch(unittest.TestCase):
|
|
|
|
@patch('gpt_researcher.agent.get_search_results', new_callable=AsyncMock)
|
|
@patch('gpt_researcher.agent.create_chat_completion', new_callable=AsyncMock)
|
|
@patch('langchain_openai.OpenAIEmbeddings')
|
|
def test_quick_search_no_summary(self, mock_embeddings, mock_create_chat, mock_search):
|
|
# Setup mocks
|
|
mock_search.return_value = [{'title': 'Test Result', 'content': 'Content', 'url': 'http://test.com'}]
|
|
|
|
# Initialize researcher with dummy config to avoid API key issues
|
|
researcher = GPTResearcher(query="test query")
|
|
|
|
# Run quick_search without summary
|
|
results = asyncio.run(researcher.quick_search("test query", aggregated_summary=False))
|
|
|
|
# Verify
|
|
self.assertEqual(len(results), 1)
|
|
self.assertEqual(results[0]['title'], 'Test Result')
|
|
mock_create_chat.assert_not_called()
|
|
|
|
@patch('gpt_researcher.agent.get_search_results', new_callable=AsyncMock)
|
|
@patch('gpt_researcher.agent.create_chat_completion', new_callable=AsyncMock)
|
|
@patch('langchain_openai.OpenAIEmbeddings')
|
|
def test_quick_search_with_summary(self, mock_embeddings, mock_create_chat, mock_search):
|
|
# Setup mocks
|
|
mock_search.return_value = [{'title': 'Test Result', 'content': 'Content', 'url': 'http://test.com'}]
|
|
mock_create_chat.return_value = "This is a summary."
|
|
|
|
# Initialize researcher
|
|
researcher = GPTResearcher(query="test query")
|
|
|
|
# Run quick_search with summary
|
|
summary = asyncio.run(researcher.quick_search("test query", aggregated_summary=True))
|
|
|
|
# Verify
|
|
self.assertEqual(summary, "This is a summary.")
|
|
mock_create_chat.assert_called_once()
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|