Skip to main content

validate_chat_transcript

Function validate_chat_transcript 

Source
pub fn validate_chat_transcript(expr: &Expr) -> Result<()>
Expand description

Validates that expr is a well-formed chat transcript and fails closed otherwise.

A transcript must be an Expr::Map with exactly one true marker among model-request, model-response, model-event, and model-card; the matching variant’s required fields are then checked. This is the domain gate the codec runs on both decode and encode.

§Examples

use sim_codec_chat::{model_response_expr, validate_chat_transcript};
use sim_kernel::Symbol;

let response = model_response_expr(
    Symbol::new("local-reasoner"),
    "qwen2.5-coder:14b",
    Vec::new(),
    Symbol::new("stop"),
);
assert!(validate_chat_transcript(&response).is_ok());