Skip to main content

Module verbatim

Module verbatim 

Source
Expand description

Verbatim stages: text the model must say word for word, verified.

A regulated call has lines that must be read exactly: a disclosure, a consent statement, the terms of a payment. An instruction to “read this verbatim” is a request, not a guarantee. A verbatim stage turns it into a guarantee at the governance level.

  • While the stage is active, the stack publishes the required text under VERBATIM_KEY.
  • At the end of each model turn, the control lane looks for the text in the model’s output transcript (contained_similarity) and writes the verdict to verbatim_flag(step). The text may be surrounded by other words in the same turn, such as a greeting before a disclosure. It also emits LiveEvent::VerbatimChecked.
  • The stage completes only once the flag is true. A paraphrase keeps the conversation in the stage, where the posture asks for the exact text again.

The check needs output transcription, since it reads what was actually said. Without a transcript nothing is verified, and the stage does not complete.

Structs§

VerbatimRequirement
The published requirement of the active verbatim stage.
VerbatimVerdict
The outcome of one verbatim check.

Constants§

VERBATIM_KEY
The state key under which the active verbatim requirement is published.
VERBATIM_MIN_SIMILARITY
How close (0–1, word level) the spoken text must be to the required text. Tolerates a transcription slip or two in a long passage, not a paraphrase.

Functions§

check_turn
Check a finished model turn against the active verbatim requirement, if any, and record the verdict in state. heard is the turn’s output transcript; an empty transcript checks nothing.
contained_similarity
How closely expected appears somewhere in heard: the best similarity between expected and a run of consecutive words of heard about as long as it (within a tenth either way). A model turn that says the required text and something else, such as “Welcome to Bright Smile. This call may be recorded. How can I help?”, scores as the text alone.
similarity
Word-level similarity of heard to expected, from 0 to 1: one minus the word edit distance over the length of the longer text, after lowercasing and dropping punctuation.
verbatim_flag
The state key holding whether step’s text was said verbatim.