discontinuedPackage flutter_gemma has been discontinued and replaced by flutter_edge_ai.

InferenceChat class

Constructors

InferenceChat({required Future<InferenceModelSession> sessionCreator()?, required int maxTokens, int tokenBuffer = 2000, bool supportImage = false, bool supportAudio = false, bool supportsFunctionCalls = false, int maxFunctionBufferLength = defaultMaxFunctionBufferLength, List<Tool> tools = const [], ModelType modelType = ModelType.gemmaIt, bool isThinking = false, ModelFileType fileType = ModelFileType.task, ToolChoice toolChoice = ToolChoice.auto, String? systemInstruction})

Properties

currentTokens → int
no setter
fileType → ModelFileType
final
fullHistory → List<Message>
no setter
hashCode → int
The hash code for this object.
no setterinherited
imageMessageCount → int
no setter
isThinking → bool
final
maxFunctionBufferLength → int
final
maxTokens → int
final
modelType → ModelType
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
session ↔ InferenceModelSession
getter/setter pair
sessionCreator → Future<InferenceModelSession> Function()?
final
supportAudio → bool
final
supportImage → bool
final
supportsFunctionCalls → bool
final
supportsImages → bool
no setter
tokenBuffer → int
final
toolChoice → ToolChoice
final
tools → List<Tool>
final

Methods

addQuery(Message message) → Future<void>
addQueryChunk(Message message, [bool noTool = false, bool prefix = false]) → Future<void>
clearHistory({List<Message>? replayHistory}) → Future<void>
close() → Future<void>
createToolsPrompt() → String
Creates tools prompt based on model type and tool choice. Made package-private for testing.
generateChatResponse() → Future<ModelResponse>
generateChatResponseAsync() → Stream<ModelResponse>
initSession() → Future<void>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
stopGeneration() → Future<void>
toString() → String
A string representation of this object.
inherited

Operators

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