ChatTurnHooks class base
What an engine (or a test) changes about one chat's turns: an engine
returns one from InferenceModel.createChatTurnHooks, once per chat, and
a test passes one to InferenceChat's constructor.
Core never calls responses for a chat with a responseFormat: a
structured turn always uses the guarded InferenceModelSession.startTurn
path. When responses returns non-null it replaces the whole plain turn;
the hook and engine own generation, parsing, history, token accounting,
take-back and overflow rebuild behavior. Core does not append that turn to
its own history.
A base class (instantiable) whose defaults are core's behaviour, so a
member added later arrives with its default. Subclasses are base or
final.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addQueryChunk(
InferenceModelSession session, Message message) → Future< void> ? -
Queue
messagethe engine's way; null = core's (tool prompt, prefix). -
history(
InferenceModelSession session) → List< Message> ? -
The transcript, when the session keeps it itself; null = the chat's.
When non-null, core's rebuilds replay this list (through
addQueryChunk), and
imageMessageCountcounts it. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
replayFailed(
InferenceModelSession session, Object error) → Future< void> - After a replay threw: the chat has already reopened its session; the hook may undo engine-side staging. The error is rethrown after it.
-
replayFinished(
InferenceModelSession session) → Future< void> -
After
clearHistory(replayHistory:)replayed every message, and after a rebuild replayed history. -
responses(
InferenceModelSession session, {required int tokenBuffer}) → Stream< ModelResponse> ? - The whole of one turn — generation, parsing, token accounting, the history append, the overflow rebuild — or null for core's.
-
tokenCount(
InferenceModelSession session) → int? - Tokens in use, when the session counts them; null = the chat's count.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited