llm/openai_chat_client library

Classes

ChatCancellation
A cancellation lifetime belongs to one prompt, including its tool rounds.
OpenAiChatClient
One Chat Completions stream. The client is closed on success, failure, subscription cancellation, timeout, and explicit stop; no shared connection lifetime can accidentally cancel another conversation.

Functions

decodeServerSentEvents(Stream<List<int>> bytes, {int maxEventBytes = 1024 * 1024, int maxResponseBytes = 16 * 1024 * 1024}) Stream<String>
Parses UTF-8 SSE independently of network chunk boundaries. Bounds are enforced before assembling an unbounded line or event, including comments.

Exceptions / Errors

ChatApiException
ChatCancelled