eager_match_policy
Policies deciding whether an eager transcript still matches the committed one.
- class pipecat.turns.user_stop.eager_match_policy.EagerMatchPolicy[source]
Bases:
ABCDecides whether a speculative response is still the right answer.
A speculative response is generated from an eager transcript, before the service commits one. This decides whether the committed transcript is close enough to the eager one for that response to stand.
- abstractmethod matches(eager: str, final: str) bool[source]
Report whether the committed transcript still matches the eager one.
- Parameters:
eager – The transcript the speculative response was generated from.
final – The transcript the service committed to.
- Returns:
True to keep the speculative response, False to discard it and answer the committed transcript instead.
- class pipecat.turns.user_stop.eager_match_policy.ExactMatch[source]
Bases:
EagerMatchPolicyKeep the response only when the two transcripts are identical.
- class pipecat.turns.user_stop.eager_match_policy.NormalizedMatch[source]
Bases:
EagerMatchPolicyKeep the response when the transcripts differ only in formatting.
Compares with case, punctuation and whitespace removed. Services commonly format the committed transcript — capitalizing it, punctuating it — while leaving the eager one raw, which
ExactMatchcounts as a difference.