fix: complete template coverage in training data + disclose model alias

This commit is contained in:
marcuspaico
2026-08-15 15:50:27 -07:00
parent cc86a97d10
commit d55d9a648c
4 changed files with 160 additions and 68 deletions

View File

@@ -1,10 +1,17 @@
from buddhagpt.datagen import build_messages, parse_pairs, dedupe
from buddhagpt.datagen import build_messages, parse_pairs, dedupe, interleaved_variant
def test_build_messages_varies_templates():
sutta = {"uid": "mn21", "title": "T", "text": "x" * 900}
prompts = {build_messages(sutta, v)[1]["content"] for v in range(6)}
assert len(prompts) == 6 # rotating templates, not one fixed prompt
def test_interleaved_variant_cycles_all_templates():
# Any run of >=6 calls must touch every template, not just the first one or two.
variants = [interleaved_variant(i) for i in range(18)]
assert set(variants) == {0, 1, 2, 3, 4, 5}
assert variants[:6] == [0, 1, 2, 3, 4, 5]
assert variants == variants[:6] * 3
def test_parse_pairs_extracts_json_lines():
out = '{"question": "Q1?", "answer": "A1"}\n{"question": "Q2?", "answer": "A2"}'
assert len(parse_pairs(out, uid="mn21")) == 2