papertrail/backend/engines/Valsci/tests/test_provider_catalog.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

57 lines
2.3 KiB
Python

import json
from pathlib import Path
from app.config.settings import Config
from app.services.provider_catalog import ProviderCatalog
def test_seed_catalog_uses_configured_model_for_ollama_provider(monkeypatch, tmp_path: Path):
monkeypatch.setattr(Config, "LLM_PROVIDER", "ollama", raising=False)
monkeypatch.setattr(Config, "LLM_BASE_URL", "http://localhost:11434/v1", raising=False)
monkeypatch.setattr(Config, "LLM_EVALUATION_MODEL", "llama3.1:8b", raising=False)
monkeypatch.setattr(Config, "MODEL_REGISTRY_OVERRIDES", {}, raising=False)
catalog = ProviderCatalog(str(tmp_path / "provider_catalog.json"))
providers = catalog.list_providers()
assert len(providers) == 1
provider = providers[0]
assert provider["provider_type"] == "ollama"
assert provider["default_model"] == "llama3.1:8b"
assert [model["model_name"] for model in provider["models"]] == ["llama3.1:8b"]
def test_ollama_default_provider_repairs_openai_seeded_model_list(monkeypatch, tmp_path: Path):
monkeypatch.setattr(Config, "LLM_PROVIDER", "ollama", raising=False)
monkeypatch.setattr(Config, "LLM_EVALUATION_MODEL", "llama3.1:8b", raising=False)
monkeypatch.setattr(Config, "MODEL_REGISTRY_OVERRIDES", {}, raising=False)
catalog_path = tmp_path / "provider_catalog.json"
catalog_path.write_text(
json.dumps(
{
"providers": [
{
"provider_id": "default",
"label": "Default Config Provider",
"provider_type": "ollama",
"enabled": True,
"base_url": "http://localhost:11434/v1",
"default_model": "llama3.1:8b",
"models": [
{"model_name": "gpt-4o", "label": "gpt-4o"},
{"model_name": "gpt-5", "label": "gpt-5"},
],
}
]
}
),
encoding="utf-8",
)
provider = ProviderCatalog(str(catalog_path)).list_providers()[0]
assert [model["model_name"] for model in provider["models"]] == ["llama3.1:8b"]
saved = json.loads(catalog_path.read_text(encoding="utf-8"))
assert saved["providers"][0]["models"][0]["model_name"] == "llama3.1:8b"