PromptLoader class

Loads prompt templates stored as XML files under lib/src/agents/prompts/.

Each XML file may contain placeholders in the form ${variableName} and conditional blocks:

<extra_instructions if="extraInstructions">
  ${extraInstructions}
</extra_instructions>

The block is included only when the extraInstructions variable is present and non-empty.

On non-VM platforms the default file-based loader is unavailable. Call setLoader at startup to inject a host-provided loader (for example, Flutter's rootBundle.loadString).

Constructors

PromptLoader()

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

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

Static Methods

load(String name, Map<String, String> variables) Future<String>
Loads and renders the prompt named name (e.g. kb_analysis.xml).
loadSync(String name, Map<String, String> variables) String
Synchronous version is not supported on all platforms.
setLoader(Future<String> loader(String name)?) → void
Overrides the default prompt loader.