Skip to content

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_id string required
  • created_at string required
  • error any

    default: null

  • data object required
    3 fields
    • utterance_id string required
    • utterance object required
    • results array of object required

      One verdict, the final's.

      7 fields
      • eager_text string

        The text of end_of_turn.data.text, the one compared. Absent on a session that masks PII (pii in a mode other than tag): the partial it went out on is not masked.

        default: null

      • eager_end number

        Seconds of audio when the turn ended.

        default: null

      • similarity number

        How close the final is to eager_text, from 0 (nothing in common) to 1 (the same). The score recommendation is decided on.

        default: null

      • lexical_similarity number

        The same, on the words alone.

        default: null

      • recommendation string required

        keep: the LLM call started on end_of_turn still answers what was said; discard: cancel it and answer the final.

        one of: keep, discard

      • reason string

        Why: same_text and similar keep; text_changed, caller_went_on and new_entity discard (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, see new_entities). The engine may add values, read it as a label.

        default: null

      • new_entities array of object

        With named_entity_recognition or pii on: the entities of the final whose words are not in eager_text; [] when there is none; null when not checked (neither add-on on, or entities: false).

        default: null

        3 fields
        • entity_type string required
        • score number required
        • text string

          The 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"
}
]
}
]
}
}