Background
During the design discussion for #793, @jakelorocco flagged that the ModelOutputThunk structure has broader issues worth addressing as a separate issue. The mot.generation sub-object pattern introduced in #793 is the first chunk; this issue covers the rest.
Current state
ModelOutputThunk still has several rough edges:
._meta is a catch-all dict inherited from CBlock. It currently holds a mix of things: raw provider responses (e.g. oai_streaming_usage, litellm_streaming_usage, chat_response), the telemetry_span, and other backend-specific data. There's no contract for what lives there.
- Computation logistics fields (
_async_queue, _first_chunk_received, etc.) are flat private attributes with no grouping.
_thinking is a private field but arguably user-facing content (like content) — it may belong public.
Proposed areas of work
- Raw provider responses — give backend-specific raw responses a dedicated typed home instead of splatting into
._meta
telemetry_span — if span data lives in ._meta, move it to a sub-structure with a clear contract
- Computation logistics — consider grouping async/streaming internal fields (
_async_queue, _first_chunk_received, etc.) similarly to how generation groups metadata
_thinking — evaluate whether this should be public
Notes
- Each area can likely be a self-contained chunk, but it's worth agreeing on the full picture first so nothing conflicts
- The
._meta rename/cleanup is the thorniest since CBlock owns it — any change there touches the whole inheritance chain
Background
During the design discussion for #793, @jakelorocco flagged that the
ModelOutputThunkstructure has broader issues worth addressing as a separate issue. Themot.generationsub-object pattern introduced in #793 is the first chunk; this issue covers the rest.Current state
ModelOutputThunkstill has several rough edges:._metais a catch-all dict inherited fromCBlock. It currently holds a mix of things: raw provider responses (e.g.oai_streaming_usage,litellm_streaming_usage,chat_response), thetelemetry_span, and other backend-specific data. There's no contract for what lives there._async_queue,_first_chunk_received, etc.) are flat private attributes with no grouping._thinkingis a private field but arguably user-facing content (likecontent) — it may belong public.Proposed areas of work
._metatelemetry_span— if span data lives in._meta, move it to a sub-structure with a clear contract_async_queue,_first_chunk_received, etc.) similarly to howgenerationgroups metadata_thinking— evaluate whether this should be publicNotes
._metarename/cleanup is the thorniest sinceCBlockowns it — any change there touches the whole inheritance chain