speculation message
The verdict of a speculative LLM turn, right after the final it is about (with
end_of_turn.speculation; receive_realtime_processing_events). Sent on a keep too.
Delivery
On the WebSocket with messages_config.receive_realtime_processing_events; to your callback as live.speculation with callback_config.receive_realtime_processing_events.
Fields
-
type"speculation" required -
session_idstring required -
created_atstring required -
erroranydefault:
null -
dataobject required3 fields
-
utterance_idstring required -
utteranceobject required -
resultsarray of object requiredOne verdict, the final's.
7 fields
-
eager_textstringThe text of
end_of_turn.data.text, the one compared. Absent on a session that masks PII (piiin a mode other thantag): the partial it went out on is not masked.default:
null -
eager_endnumberSeconds of audio when the turn ended.
default:
null -
similaritynumberHow close the final is to
eager_text, from 0 (nothing in common) to 1 (the same). The scorerecommendationis decided on.default:
null -
lexical_similaritynumberThe same, on the words alone.
default:
null -
recommendationstring requiredkeep: the LLM call started onend_of_turnstill answers what was said;discard: cancel it and answer the final.one of:
keep,discard -
reasonstringWhy:
same_textandsimilarkeep;text_changed,caller_went_onandnew_entitydiscard (caller_went_on: the speaker kept talking after the end of turn, so the turn was not over;new_entity: the final names an entity the eager text lacked, seenew_entities). The engine may add values, read it as a label.default:
null -
new_entitiesarray of objectWith
named_entity_recognitionorpiion: the entities of the final whose words are not ineager_text;[]when there is none;nullwhen not checked (neither add-on on, orentities: false).default:
null3 fields
-
entity_typestring required -
scorenumber required -
textstringThe entity's words. Absent on a session that masks PII.
default:
null
-
-
-
Example
{ "type": "speculation", "session_id": "string", "created_at": "string", "error": null, "data": { "utterance_id": "string", "utterance": {}, "results": [ { "eager_text": "string", "eager_end": 0.5, "similarity": 0.5, "lexical_similarity": 0.5, "recommendation": "keep", "reason": "string", "new_entities": [ { "entity_type": "string", "score": 0.5, "text": "string" } ] } ] }}