Expand description
Shared streaming-virtual-fields module for e2e test codegen.
Chat-stream fixtures assert on “virtual” fields that don’t exist on the
stream result type itself — chunks, chunks.length, stream_content,
stream_complete, no_chunks_after_done, tool_calls, finish_reason.
These fields resolve against the collected list of chunks produced by
draining the stream.
StreamingFieldResolver provides two entry points:
StreamingFieldResolver::accessor— the language-specific expression for a virtual field given a local variable that holds the collected list.StreamingFieldResolver::collect_snippet— the language-specific code snippet that drains a stream variable into the collected list.
§Convention
The chunks_var parameter is the local variable name that holds the
collected list (default: "chunks"). The stream_var parameter is the
result variable produced by the stream call (default: "result").
The set of streaming-virtual field names handled by this module:
chunks→ the collected list itselfchunks.length→ length/count of the collected liststream_content→ concatenation of all delta content stringsstream_complete→ boolean — last chunk has a non-null finish_reasonno_chunks_after_done→ structural invariant (true by construction for channel/iterator-based APIs once the channel is closed; emitted asassert!(true)/assertTruefor languages without post-DONE chunk plumbing)tool_calls→ flat list of tool_calls from all chunk deltasfinish_reason→ finish_reason string from the last chunk
Structs§
- Streaming
Field Resolver - Shared streaming-virtual-fields resolver for e2e test codegen.
Constants§
- STREAMING_
VIRTUAL_ FIELDS - The set of field names treated as streaming-virtual fields.
Functions§
- is_
streaming_ virtual_ field - Returns
truewhenfieldis a streaming-virtual field name.