Skip to main content

parse_delta

Function parse_delta 

Source
pub fn parse_delta(
    value: &Value,
    tool_ids: &mut HashMap<i64, String>,
) -> Option<ChatResponseUpdate>
Expand description

Parse one streamed chat.completion.chunk value into an update, resolving tool-call ids from the index map (a streamed tool-call delta only carries its id on the first chunk; later chunks reference it by index).

A near-identical shape to agent-framework-openai’s private parse_delta (Copilot’s SSE chunks are byte-for-byte the same shape) — reimplemented locally, rather than reused, purely so it is directly unit-testable here over fixture JSON without a live HTTP response.