Skip to main content

parse_response

Function parse_response 

Source
pub fn parse_response(body: &[u8]) -> Result<Response, String>
Expand description

Parse an OpenAI /chat/completions response body into the neutral Response. Tolerant: missing usage → zero; unknown finish reason → StopReason::Other; tool-call arguments that aren’t valid JSON are wrapped as {"_raw": "…"} rather than dropped.