Skip to main content

Module parser

Module parser 

Source
Expand description

Top-level streaming parser for chat-adapter responses.

Composes MarkerDetector (recognises [[ ## name ## ]] boundaries) with per-field FieldParser sub-parsers (handles the per-FieldType content semantics). Emits a typed super::event::ParseEvent stream that mirrors the schema tree as values arrive.

Mirrors the buffered ChatAdapter::parse (in typesayer) contract:

  • Field order is what the LM emits, not declared order.
  • First occurrence wins if a field marker repeats.
  • [[ ## completed ## ]] is the stream-end sentinel; events after it are silently consumed.
  • Single-string-output signature + no markers ever → the entire completion is the value (the buffered parser’s single output + no markers fallback).

Structs§

ChatStreamParser
Push-driven streaming parser for chat-adapter completions.