FfiInferenceModelSession class

FFI implementation of InferenceModelSession. Buffers query chunks until getResponse is called.

Routes all per-conversation native calls through handle — its own ConversationHandle — so multiple sessions on one model are fully isolated. extractTextFromResponse is a static helper on LiteRtLmFfiClient and needs no instance.

Inheritance
Mixed-in types

Constructors

FfiInferenceModelSession({required ConversationHandle handle, required ModelType modelType, required ModelFileType fileType, required bool supportImage, required bool supportAudio, bool enableThinking = false, required VoidCallback onClose})

Properties

enableThinking → bool
final
fileType → ModelFileType
final
handle → ConversationHandle
final
hashCode → int
The hash code for this object.
no setterinherited
lastRawResponse → String?
Most recent raw SDK JSON. Returns the response of the last getResponse or getResponseAsync. For Gemma 4 use LiteRtLmFfiClient.extractToolCalls on this string to surface tool calls.
no setteroverride
modelType → ModelType
final
onClose → VoidCallback
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
supportAudio → bool
final
supportImage → bool
final

Methods

addQueryChunk(Message message) → Future<void>
override
close() → Future<void>
override
getResponse() → Future<String>
override
getResponseAsync() → Stream<String>
override
getSessionMetrics() → SessionMetrics
Get session metrics including token usage and performance stats.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sizeInTokens(String text) → Future<int>
override
stopGeneration() → Future<void>
override
toString() → String
A string representation of this object.
inherited

Operators

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