Skip to main content

tilo_model_client/
validation.rs

1use serde_json::Value;
2
3/// Read provider-authored reasoning metadata for same-conversation replay.
4/// This is separate from user-visible final content; absent/null stays absent.
5/// # Errors
6/// Rejects non-string reasoning content rather than guessing or coercing it.
7pub fn reasoning_content(message: &Value) -> Result<Option<&str>, String> {
8    match message.get("reasoning_content") {
9        None | Some(Value::Null) => Ok(None),
10        Some(Value::String(text)) => Ok(Some(text)),
11        Some(_) => Err("the model's reasoning_content was not a string".into()),
12    }
13}