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).
44 lines
1.5 KiB
Python
44 lines
1.5 KiB
Python
from unittest.mock import AsyncMock, MagicMock, patch
|
|
|
|
import pytest
|
|
|
|
from gpt_researcher.utils.llm import create_chat_completion
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_create_chat_completion_accepts_max_tokens_above_old_32k_cap():
|
|
provider = MagicMock()
|
|
provider.get_chat_response = AsyncMock(side_effect=["ok-64000", "ok-128000"])
|
|
|
|
with patch("gpt_researcher.utils.llm.get_llm", return_value=provider) as mock_get_llm:
|
|
accepted_values = (
|
|
(64_000, "ok-64000"),
|
|
(128_000, "ok-128000"),
|
|
)
|
|
|
|
for max_tokens, expected in accepted_values:
|
|
result = await create_chat_completion(
|
|
messages=[{"role": "user", "content": "Generate a report"}],
|
|
model="claude-sonnet-4-6",
|
|
max_tokens=max_tokens,
|
|
llm_provider="anthropic",
|
|
)
|
|
|
|
assert result == expected
|
|
|
|
assert [call.kwargs["max_tokens"] for call in mock_get_llm.call_args_list] == [64_000, 128_000]
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_create_chat_completion_rejects_absurd_max_tokens():
|
|
with patch("gpt_researcher.utils.llm.get_llm") as mock_get_llm:
|
|
with pytest.raises(ValueError, match="env vars|typos"):
|
|
await create_chat_completion(
|
|
messages=[{"role": "user", "content": "Generate a report"}],
|
|
model="claude-sonnet-4-6",
|
|
max_tokens=1_000_000,
|
|
llm_provider="anthropic",
|
|
)
|
|
|
|
mock_get_llm.assert_not_called()
|