Refactor to request matching/replacement substrings from LLMs, rather than requesting a complete replacement for the full original text

This commit is contained in:
2026-04-21 12:33:15 -05:00
parent 23532cade1
commit 4296e3576e
5 changed files with 102 additions and 50 deletions

View File

@@ -49,8 +49,8 @@ def _transcript():
def test_pipeline_processes_with_fake_llm_and_cleans_work_dir(tmp_path):
correction = CorrectionCandidate(
segment_id=0,
original_text="I ask Chontia.",
corrected_text="I ask Chauntea.",
original_text="Chontia",
corrected_text="Chauntea",
confidence=0.95,
)
fake_client = FakeLLMClient([CorrectionSet(corrections=[correction])])
@@ -71,7 +71,7 @@ def test_pipeline_skips_bad_correction_and_preserves_diagnostics(tmp_path):
correction = CorrectionCandidate(
segment_id=0,
original_text="Different text.",
corrected_text="I ask Chauntea.",
corrected_text="Chauntea",
confidence=0.95,
)
fake_client = FakeLLMClient([CorrectionSet(corrections=[correction])])
@@ -93,4 +93,4 @@ def test_pipeline_skips_bad_correction_and_preserves_diagnostics(tmp_path):
assert skipped_path.exists()
diagnostics = json.loads(skipped_path.read_text(encoding="utf-8"))
assert diagnostics["skipped_corrections"][0]["segment_id"] == 0
assert "original_text" in diagnostics["skipped_corrections"][0]["reason"]
assert "does not match any substring" in diagnostics["skipped_corrections"][0]["reason"]