Skip to main content

encode_user_prompt_with_content

Function encode_user_prompt_with_content 

Source
pub fn encode_user_prompt_with_content(
    content: &[Value],
    session_id: &str,
    uuid: &str,
) -> Result<String, Error>
Expand description

Encode a user-turn line with structured content blocks (text + image) as the message body. Use this when the prompt includes images or other non-text blocks; for plain text use encode_user_prompt which emits the simpler bare-string form.

content is forwarded verbatim as the message body’s content field - callers must build CLI-compatible block objects (e.g. {"type":"text","text":"..."}, {"type":"image","source":{...}}).

uuid is stamped as it is on the text form, for the same reason.

§Errors

Error::MessageParse wrapping a JSON serialization failure.