Expand description
Reading the Azure Server-Sent Events stream: one line at a time, and far enough into a response to know which parser the rest of it belongs to.
Structsยง
- Classified
Response ๐ - The head of an Azure response, read far enough to know which parser the rest of it belongs to.
Enumsยง
- Azure
Stream ๐Event - One Azure SSE event name, classified once instead of by a separate
&strmatch in each parser that reacts to it. - Parsed
Response ๐Line
Constantsยง
- ALL_
EXPECTED_ ๐EVENTS - Azure events that no parser needs to react to, or that some parser handles while another legitimately sees them. An event outside this list is logged as unexpected, so a name Azure starts sending has to be added here even when nothing acts on it.
Functionsยง
- classified ๐
- The classification, once the round is known, failing if Azure never named the response.
- detect_
response_ ๐kind - Reads the head of
linesuntil it is clear whether the round is a tool call or a text answer, and hands the rest of the stream on to the parser that suits it. - parser_
for_ ๐item - Which parser the rest of the round belongs to, going by the item it just announced, or
Nonefor an item that says nothing about it. - sse_
field ๐ - The value of an SSE field, or
Nonewhen the line is a different field. The space after the colon is optional in the SSE grammar, so adata:{...}line carries an item like any other.