Record glossary provenance without transcript mutation
This commit is contained in:
@@ -137,6 +137,43 @@ class ProtocolInputBudgetTests(unittest.TestCase):
|
||||
self.assertEqual(result.transcript_input, compact)
|
||||
self.assertEqual(call.call_count, 1)
|
||||
|
||||
def test_glossary_aliases_do_not_mutate_protocol_input_or_source_artifact(
|
||||
self,
|
||||
) -> None:
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
document = {
|
||||
"text": "Lumini und Carbofool.",
|
||||
"segments": [
|
||||
{
|
||||
"start": 0.0,
|
||||
"end": 1.0,
|
||||
"speaker_id": "SPEAKER_00",
|
||||
"text": "Lumini und Carbofool.",
|
||||
}
|
||||
],
|
||||
"speaker_labels_anonymous": True,
|
||||
}
|
||||
transcript = self._write(root, document)
|
||||
source_before = transcript.read_bytes()
|
||||
|
||||
result = generate_direct_protocol(
|
||||
transcript,
|
||||
glossary_aliases={"Lumini": "Luminy", "Carbofool": "Carbofol"},
|
||||
model_check=Mock(return_value={}),
|
||||
generation_call=Mock(return_value=completed_generation()),
|
||||
)
|
||||
|
||||
self.assertEqual(transcript.read_bytes(), source_before)
|
||||
|
||||
self.assertIn("SPEAKER_00: Lumini und Carbofool.", result.transcript_input)
|
||||
self.assertIn("SPEAKER_00: Lumini und Carbofool.", result.exact_prompt)
|
||||
self.assertEqual(result.runtime_metadata["glossary_replacements"], [])
|
||||
self.assertEqual(
|
||||
result.runtime_metadata["glossary_aliases_configured"],
|
||||
{"Carbofool": "Carbofol", "Lumini": "Luminy"},
|
||||
)
|
||||
|
||||
def test_mapped_speakers_and_statements_reach_final_ollama_payload(self) -> None:
|
||||
diarized = {
|
||||
"text": "",
|
||||
|
||||
Reference in New Issue
Block a user