Expand description
SSE stream chunk conversion helpers. Functions to convert SSE chunks between OpenAI and Anthropic formats.
Functions§
- chunk_
to_ anthropic - Convert a raw SSE chunk to Anthropic format.
If the chunk already looks like Anthropic format (has event type fields), return as-is.
Handles
data: [DONE]terminator. - chunk_
to_ openai - Convert a raw SSE chunk to OpenAI format.
If the chunk already looks like OpenAI format (has “choices”), return as-is.
Handles
data: [DONE]terminator.