Skip to main content

decode

Function decode 

Source
pub fn decode(body: &[u8]) -> Result<RunAgentInput>
Expand description

Parses a RunAgentInput from raw JSON bytes.

The transport-free half of the extractor, for tests and for callers that already hold the body.

let input = decode(br#"{"threadId":"t","runId":"r","messages":[],"tools":[],"context":[]}"#)?;
assert_eq!(input.run_id.as_str(), "r");

assert!(decode(b"").is_err());
assert!(decode(b"{").is_err());