Skip to main content

parse_rtdl_assistant_response

Function parse_rtdl_assistant_response 

Source
fn parse_rtdl_assistant_response(raw: &str) -> Result<(String, Value)>
Expand description

Parses one VLM reply in RTDL envelope form.

The model must emit a JSON object (single root) whose only keys are content and rtdl: content is user-facing narration (string); rtdl is the declarative ops tree (another JSON object) consumed by expand_rtdl_to_plan.

Returns (content, rtdl) on success — the string is cloned for callers; rtdl is a serde_json::Value object subtree (not validated beyond “rtdl is an object”).

Fails if raw is not valid JSON, the root is not an object, the key set is not exactly {content, rtdl}, content is not a JSON string, or rtdl is not a JSON object.