Updated the LLM prompt to enforce acoustic/phoenetic similarity requirements for proposed corrections

This commit is contained in:
2026-04-21 10:46:00 -05:00
parent 8f6c721f06
commit 8c80c942dd
2 changed files with 43 additions and 2 deletions

34
tests/test_prompts.py Normal file
View File

@@ -0,0 +1,34 @@
from audita.chunking import chunk_transcript
from audita.prompts import build_glossary_correction_messages
from audita.schemas import parse_glossary_yaml, parse_transcript_json
def test_prompt_requires_acoustically_plausible_transcription_errors():
transcript = parse_transcript_json(
"""
[
{"speaker": "Eric", "start": 0.0, "end": 1.0, "text": "The gestures are nearby."}
]
"""
)
glossary = parse_glossary_yaml(
"""
glossary:
- name: "Jesters"
category: faction
summary: "The Jesters are a local faction."
- name: "Lyra"
category: npc
summary: "Lyra is a hostile NPC."
"""
)
section = chunk_transcript(transcript, max_section_tokens=16000)[0]
messages = build_glossary_correction_messages(section, glossary)
prompt_text = "\n".join(message["content"] for message in messages)
assert "acoustically plausible" in prompt_text
assert "phonetically or acoustically similar" in prompt_text
assert '"gestures" to "Jesters"' in prompt_text
assert '"Lyra" to "Jesters"' in prompt_text
assert "should be omitted" in prompt_text