Skip to content

refactor(core): promote mot._thinking to public mot.thinking #1217

Closed

Description

@ajbozarth

Sub-issue of #909. Design discussed in #1197 Area 4.

Summary

_thinking is documented as private (single underscore) but referenced publicly in docs/docs/integrations/openai.md:

If you intend to use thinking mode, read the reasoning trace from result._thinking rather than result.value.

Promote to mot.thinking; keep _thinking as a deprecated alias for one minor release.

Design

  • Rename the attribute to mot.thinking (no leading underscore).
  • Add a _thinking property that returns self.thinking and emits DeprecationWarning on read.
  • Backends keep populating through the public name.
  • Update docs/docs/integrations/openai.md to reference result.thinking in the same PR.

Considered alternatives (rejected)

  • mot.generation.thinking — matches the "execution metadata" flavor of usage and finish_reasons. Rejected: reasoning is content the model produced, semantically closer to value than to usage; longer dotted path for content most users want directly.
  • mot.reasoning.* namespace — would give room for future structured reasoning data. Rejected as speculative: reasoning is currently a flat string across all backends. mot.thinking doesn't preclude introducing mot.reasoning.* later.

Deprecation horizon

One minor cycle, then remove (OQ3 resolution). Pre-1.0 + the only published reference is in our own docs (updated in this PR). One minor with DeprecationWarning is sufficient.

Related: #1201

Promoting mot.thinking to public is only half the story — Message has no thinking field and chat.py:_parse ignores _thinking entirely, so reasoning is silently dropped in multi-turn chat. #1201 tracks the Message-level fix. Both should ship together if possible (so a freshly-public mot.thinking actually round-trips through chat history), but #1201 is independent and can ship later if needed.

Appendix items folded in

From #1197's Appendix A:

  • Item 9 — docs/docs/integrations/openai.md instructs users to read result._thinking. Update to result.thinking in this PR.

Acceptance

  • mot.thinking is the public attribute; backends write through the public name
  • mot._thinking is a deprecation-warning shim
  • docs/docs/integrations/openai.md updated
  • Existing tests unchanged in behavior
  • Release notes / changelog entry calling out the deprecation horizon
  • Better handling of reasoning output from thinking models #1201 cross-referenced

Sequencing

Independent of Area 1 (#1215), Area 3 (#1216), Area 5 (#1191) and of #1181. Can ship in any order.

Activity

  1. added
    documentationImprovements or additions to documentation
    area/stdlibCore abstractions: Context, MOT, SamplingStrategy, formatters, serialization
    on Jun 5, 2026
  2. added
    p2Medium/low: minor bugs, niche features, polish, docs, tests, cleanup. Scoped, lower urgency.
    on Jun 18, 2026
  3. exequeryphil commented on Jun 18, 2026

    @exequeryphil
    Contributor

    Hi, I can address this one.

  4. ajbozarth commented on Jun 18, 2026

    @ajbozarth
    MemberAuthor

    Thank you for your interest @exequeryphil I've assigned this issue to you, feel free to open a PR when it's ready and tag me for review

  5. ajbozarth commented on Jun 19, 2026

    @ajbozarth
    MemberAuthor

    Small heads-up (2026-06-19)

    Two factual updates if helpful while picking this up:

    • File path: mellea/stdlib/base.py → mellea/core/base.py (codebase reorg since the design was written).
    • The issue body cites one result._thinking line in docs/docs/integrations/openai.md; current state has two — lines 360 and 386.

    No design changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/stdlibCore abstractions: Context, MOT, SamplingStrategy, formatters, serializationdocumentationImprovements or additions to documentationp2Medium/low: minor bugs, niche features, polish, docs, tests, cleanup. Scoped, lower urgency.refactor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions