Skip to content

ModelOutputThunk structural cleanup — ._meta partitioning, raw responses, _thinking #909

@ajbozarth

Description

@ajbozarth

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

  1. Raw provider responses — give backend-specific raw responses a dedicated typed home instead of splatting into ._meta
  2. telemetry_span — if span data lives in ._meta, move it to a sub-structure with a clear contract
  3. Computation logistics — consider grouping async/streaming internal fields (_async_queue, _first_chunk_received, etc.) similarly to how generation groups metadata
  4. _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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions