radfact-lite
Lightweight, text-only RadFact with OpenAI and Ollama backends.
Parses reports into phrases, optionally removes normal (non-pathological) findings, then scores bidirectional LLM entailment as logical precision / recall / F1.
This library was created for the ODIN 2026 challenge.
Install
pip install radfact-lite
Usage
from radfact_lite import ModelConfig, PipelineModels, RadFactLitePipeline, ReportType
cfg = ModelConfig(model="gpt-4o-mini", provider="openai") # reads OPENAI_API_KEY
models = PipelineModels(parse_model=cfg, entailment_model=cfg, filtering_model=cfg)
pipeline = RadFactLitePipeline(models, report_type=ReportType.TOOTHFAIRY)
aggregate, per_sample = pipeline.compute_radfact(
candidates_by_id={"id1": "Absence of tooth 4.8. Endosseous implant in position 4.6."},
references_by_id={"id1": "Endosseous implant in position 4.6, correctly osseointegrated. All other teeth are present."},
remove_normal_findings=True,
)
print(aggregate.logical_f1)
For Ollama: ModelConfig(model="llama3.1", provider="ollama") (default base URL http://localhost:11434/v1).
Pass pre-parsed phrase lists instead of narrative text with is_narrative_text=False.
Report types
report_type selects the prompt set used for parsing, filtering, and entailment:
ReportType.GENERAL(default) — generic medical imaging prompts that work in any medical context.ReportType.TOOTHFAIRY— maxillofacial CBCT reports (ODIN 2026 / ToothFairy).ReportType.BITE2TEXT— orthodontic occlusion reports from intraoral scans/photographs (Bite2Text).
Debugging
Set RADFACT_LITE_DEBUG=1 to log every LLM call (report parsing, finding filtering, entailment) to stderr, including inputs, outputs, and pipeline stage markers.
New modalities
Add prompt files (system_message.txt and few_shot_examples.json) under src/prompts/{report_to_phrases,finding_filter,entailment}/<modality>/ and a value to ReportType in src/rf_types.py.
Metadata
Release files for radfact-lite 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| radfact_lite-0.2.0.tar.gz | 16.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| radfact_lite-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.7 kB
Release files / radfact_lite-0.2.0.tar.gz
| Download URL | radfact_lite-0.2.0.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0cc2717a3626da05bc0e06d1607236e6f487482588d497a30d10bfb338b4d3a
|
|
BLAKE2b-256 checksum How to use checksums |
7876c6d13ee88da74bff311c2649bd3c25f60237ae5eed9baf8d87c6fff8ca87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / radfact_lite-0.2.0-py3-none-any.whl
| Download URL | radfact_lite-0.2.0-py3-none-any.whl |
|---|---|
| Size | 26.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ceba02392590d1e017dc1006b62fa1076dbcc79f82ffc34fefff820606b22882
|
|
BLAKE2b-256 checksum How to use checksums |
b1725cd596129bdd1526b4f1745ddef702f5fe2ef922957a1135096722bbe8c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|