ConversationBuilder class

Constructors

ConversationBuilder({required String systemMessage, required List<ToolDescriptor> tools, ObservationRenderer? renderer})

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

appendAssistantTurn(String thinking, ({Map<String, dynamic> args, String tool}) action) → void
Append an assistant-role turn — the thinking text (empty when the provider produced none) plus the validated tool call.
appendUserTurn(Observation obs, ObservationDiff diff, {Map<String, dynamic>? toolResult}) → void
Append a user-role turn. toolResult carries a previous action result or a schema/validation-retry error map; null when this turn was a clean observation.
estimatedTokens() → int
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
snapshot() → ConversationSnapshot
Immutable snapshot of the conversation state. The returned snapshot reuses the same system-message string instance across calls — Dart string canonicalisation makes the system prefix byte-identical for KV-cache friendliness.
toString() → String
A string representation of this object.
inherited
trimIfOverBudget(int threshold) → void
Drop observation from the oldest non-trimmed UserTurn until estimatedTokens is <= threshold or no trimmable turns remain. Trimmed turns keep their UserTurn.diff intact so the model still sees the delta sequence; only the heavy observation body is replaced with Observation.empty.

Operators

operator ==(Object other) → bool
The equality operator.
inherited