Skip to main content

Module transcript

Module transcript 

Source
Expand description

Conversation validation 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.

Functions§

tool_result_message
Constructs a synthetic tool result containing verbatim text, such as recovery feedback or a skip reason. JSON-shaped text is not reinterpreted as structured or multimodal output.
tool_result_output
Shape a canonical real tool output as a tool result without reparsing text.
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.