Lfm2ChatFormat class

LFM's ChatFormat: Lfm2ChatTemplate rendering paired with Lfm2StreamDecoder output splitting.

Covers the text and vision variants for LFM2 and LFM2.5. They share the same ChatML wire format and tool-call markers, but differ in whether tool declarations/results are wrapped in Liquid's LFM2-only tool tags.

Implemented types

Constructors

Lfm2ChatFormat({LfmToolTagStyle toolTagStyle = LfmToolTagStyle.lfm2, LfmToolCallSyntax toolCallSyntax = LfmToolCallSyntax.pythonic})
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
supportsThinking bool
Whether this family has a dedicated reasoning ("thinking") channel.
no setteroverride
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

decode(Stream<String> tokens) Stream<ChatResponseUpdate>
Splits a raw generated-token stream into M.E.AI updates, separating prose (TextContent), reasoning (TextReasoningContent), and tool calls (FunctionCallContent).
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
render(Iterable<ChatMessage> messages, {Iterable<AIFunctionDeclaration> tools = const <AIFunctionDeclaration>[], bool enableThinking = false}) RenderedPrompt
Renders messages (with optional tools) into the family's wire format.
override
toString() String
A string representation of this object.
inherited

Operators

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