AssistantConfig class final
How an assistant behaves: its tools, prompt, replies, questions, lists, guards and texts. Runtime wiring (engine,
load settings, prefix store) goes to the Assistant constructor.
- Annotations
Constructors
-
AssistantConfig({required Toolkit toolkit, required PromptLayout prompt, ModelProfile? profile, ReplyStrategy replies = const ModelWrittenReplies(), ConfirmationPolicy confirmation = const ConfirmationPolicy(), ListReferences listReferences = const ListReferences(), ScreenRequestMapper? screenRequests, List<
OutputGuard> guards = const [], OutputRewriter? rewriter, TurnHook? beforeModel, ToolGate? beforeTool, AssistantStrings strings = AssistantStrings.english, GrammarOptions grammar = const GrammarOptions(), SamplingOptions? sampling, Duration toolStatusDelay = Duration.zero, Duration? toolTimeout, ToolErrorPolicy toolErrors = ToolErrorPolicy.failTurn, DateTime today()?, bool restoreOpenQuestion = true}) -
const
-
AssistantConfig.basic({required String systemPrompt, List<
AssistantTool> tools = const [], AssistantStrings strings = AssistantStrings.english, String contextLine(DateTime today)? = ContextLines.english}) -
A config with
systemPrompt,toolsand the defaults: the model writes the replies after a call, irreversible tools ask first,contextLineopens the newest user message.factory
Properties
- beforeModel → TurnHook?
-
Runs before the model call of each user message.
final
- beforeTool → ToolGate?
-
Runs before each call the assistant makes (not the host's): a non-null result stands for the call's.
final
- confirmation → ConfirmationPolicy
-
Which calls wait for a yes.
final
- grammar → GrammarOptions
-
How the tool-call grammar is built.
final
-
guards
→ List<
OutputGuard> -
Checks of the model's plain answers, in order; the first verdict wins.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- listReferences → ListReferences
-
How results show numbered lists and arguments name their items.
final
- profile → ModelProfile?
-
The model family; null detects it from the model (
ModelProfile.detect). A loaded model keeps its profile until the next load.final - prompt → PromptLayout
-
The prompt's layout.
final
- replies → ReplyStrategy
-
Who writes the reply after a call.
final
- restoreOpenQuestion → bool
-
Whether
Assistant.restorebrings back a snapshot's open question and offer (the default). False drops them, as a message that is not a yes or a no does: no question is open, no offer waits, the items come back without their actions (only an open question has any, its yes and no), so the item that asked shows its text alone, and(its user text, strings.declined)joins the history; a yes typed next goes to the model. For a toolkit whosereset(whichrestoreruns) forgets the lists they name, where a yes could only answer that the list is gone, set it false.final - rewriter → OutputRewriter?
-
Rewrites the model's streamed text and plain answers (never app-written replies).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sampling → SamplingOptions?
-
The sampling of every generation; null uses the profile's.
final
- screenRequests → ScreenRequestMapper?
-
The screen an executed call asks the host to open; null for none.
final
- strings → AssistantStrings
-
The conversation texts.
final
- today → DateTime Function()?
-
The conversation's day, read at every turn (the prompt's date line and
ToolContext.today); null uses the assistant's clock.final - toolErrors → ToolErrorPolicy
-
What happens when a tool throws.
final
- toolkit → Toolkit
-
The tools.
final
- toolStatusDelay → Duration
-
A pause between showing a tool's status label and running it, so the label can be read.
final
- toolTimeout → Duration?
-
Longest wait for a tool's result (a tool's own timeout wins); null waits forever. A call that times out gives
ToolFailure('timeout', AssistantStrings.toolFailed)and its context is cancelled.final
Methods
-
copyWith(
{Toolkit? toolkit, PromptLayout? prompt, ModelProfile? profile, ReplyStrategy? replies, ConfirmationPolicy? confirmation, ListReferences? listReferences, ScreenRequestMapper? screenRequests, List< OutputGuard> ? guards, OutputRewriter? rewriter, TurnHook? beforeModel, ToolGate? beforeTool, AssistantStrings? strings, GrammarOptions? grammar, SamplingOptions? sampling, Duration? toolStatusDelay, Duration? toolTimeout, ToolErrorPolicy? toolErrors, DateTime today()?, bool? restoreOpenQuestion}) → AssistantConfig - A copy with the given fields replaced (a null argument keeps the current value).
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited