yera.runtime.blocks.thinking

Emit model reasoning as a one-shot block or an ordered stream.

A one-shot call emits reasoning content and immediately closes the block. A ThinkingStream retains one block identity across chunks, allowing renderers to update a dedicated reasoning view until the context exits.

Symbols

class ThinkingStream — Stream chunks of model reasoning into one thinking block.

ThinkingStream

Inherits: _StreamHandle

Stream chunks of model reasoning into one thinking block.

Methods

__init__ — Initialize a thinking stream.
__enter__ — Open the thinking block scope.
__exit__ — Close the thinking block scope.
append — Append a reasoning chunk.

ThinkingStream.__init__

__init__(
    block_id: str,
)

Initialize a thinking stream.

Parameters

block_id
type: str

Identity shared by all emitted chunks.

ThinkingStream.__enter__

__enter__()

Open the thinking block scope.

Returns

This active thinking stream.

ThinkingStream.__exit__

__exit__(
    exc_type: type[BaseException],
    exc_value: BaseException | None,
    traceback: TracebackType,
)

Close the thinking block scope.

Parameters

exc_type
type: type[BaseException]

Type of exception leaving the context, if any.

exc_value
type: BaseException | None

Exception leaving the context, if any.

traceback
type: TracebackType

Traceback associated with the exception, if any.

Returns

False so exceptions propagate from the managed block.

ThinkingStream.append

append(
    content: str,
) → None

Append a reasoning chunk.

Parameters

content
type: str

Partial model reasoning content.