Skip to main content

Module transcript

Module transcript 

Source
Expand description

Conversation validation and repair, assistant-turn classification, and constructors for real or synthetic tool results.

use rig_core::{message::Message, transcript::validate_canonical};

validate_canonical(&[Message::user("Hello"), Message::assistant("Hi")])?;

Enums§

TranscriptError
Why a history is not a canonical transcript. See validate_canonical.

Constants§

TOOL_NOT_EXECUTED_DUE_TO_INVALID_PEER
The result every other call of a turn gets when one call was retried or skipped: none of the turn’s calls ran.

Functions§

assistant_text_from_choice
The text parts of an assistant turn, concatenated.
invalid_arguments_feedback
What the model reads when its call to tool sent raw, arguments that are not a JSON object: the tool never ran, and the model calls it again.
invalid_call_feedback
The tool results answering a turn with an invalid call, in call order: feedback for the call invalid, TOOL_NOT_EXECUTED_DUE_TO_INVALID_PEER for every other call. Empty when content has no tool calls.
is_empty_assistant_turn
Whether a generated assistant turn is empty: every part is blank (AssistantContent::is_blank, the rule replay drops parts by). An empty turn must not enter history.
not_executed
The result of a call the run did not execute because a call beside it was invalid.
tool_result_message
Constructs the error result of a call that never ran, its text verbatim, such as recovery feedback or a skip reason. JSON-shaped text is not reinterpreted as structured or multimodal output.
tool_result_output
Shape a tool’s result as the tool result the model reads, without reparsing text. Anything but a success is an error result.
validate_canonical
Rejects consecutive assistant messages, unanswered tool-call IDs, and results without a pending call. Each pending ID must be answered once in the next user message, before another assistant message or the end of history. System messages reset the consecutive-assistant check but retain pending calls. Duplicate call IDs are treated as one pending ID.