Lfm2ChatTemplate class

Renders Liquid LFM prompts from M.E.AI chat messages and tool declarations.

Constructors

Lfm2ChatTemplate({LfmToolTagStyle toolTagStyle = LfmToolTagStyle.lfm2, LfmToolCallSyntax toolCallSyntax = LfmToolCallSyntax.pythonic})
Creates an LFM prompt renderer.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toolCallSyntax LfmToolCallSyntax
How assistant tool-call examples are rendered back into chat history.
final
toolTagStyle LfmToolTagStyle
Whether tool declarations/results use LFM2 tags or LFM2.5 plain JSON.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parse(String generated) Lfm2Turn
Parses one raw generated model turn into prose plus any tool calls.
render(Iterable<ChatMessage> messages, {Iterable<AIFunctionDeclaration> tools = const <AIFunctionDeclaration>[], bool enableThinking = false, bool addGenerationPrompt = true}) Lfm2Prompt
Renders messages (with optional tools) into an LFM2 prompt.
toString() String
A string representation of this object.
inherited

Operators

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

Constants

imEnd → const String
imStart → const String
mediaMarker → const String
mtmd's default media marker, reused from the Gemma template. One is emitted per attached image; the runtime substitutes the model's image tokens.
stopSequences → const List<String>
Stop sequences a caller passes to generation.
toolCallEnd → const String
toolCallStart → const String
toolListEnd → const String
toolListStart → const String
toolResponseEnd → const String
toolResponseStart → const String