papertrail/backend/engines/gpt-researcher/tests/documents-report-source.py
caelum0x 174222bcaa feat: Builder-Track named-user tools, bio + evidence-intelligence platform, Apache-2.0
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).
2026-07-10 16:23:13 +03:00

55 lines
1.6 KiB
Python

import os
import asyncio
import pytest
# Ensure this path is correct
from gpt_researcher import GPTResearcher
from dotenv import load_dotenv
load_dotenv()
# Define the report types to test
report_types = [
"research_report",
"custom_report",
"subtopic_report",
"summary_report",
"detailed_report",
"quick_report"
]
# Define a common query and sources for testing
query = "What can you tell me about myself based on my documents?"
# Define the output directory
output_dir = "./outputs"
@pytest.mark.asyncio
@pytest.mark.parametrize("report_type", report_types)
async def test_gpt_researcher(report_type):
# Ensure the output directory exists
if not os.path.exists(output_dir):
os.makedirs(output_dir)
# Create an instance of GPTResearcher with report_source set to "documents"
researcher = GPTResearcher(
query=query, report_type=report_type, report_source="documents")
# Conduct research and write the report
await researcher.conduct_research()
report = await researcher.write_report()
# Define the expected output filenames
pdf_filename = os.path.join(output_dir, f"{report_type}.pdf")
docx_filename = os.path.join(output_dir, f"{report_type}.docx")
# Check if the PDF and DOCX files are created
# assert os.path.exists(pdf_filename), f"PDF file not found for report type: {report_type}"
# assert os.path.exists(docx_filename), f"DOCX file not found for report type: {report_type}"
# Clean up the generated files (optional)
# os.remove(pdf_filename)
# os.remove(docx_filename)
if __name__ == "__main__":
pytest.main()