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§
- Transcript
Error - 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.