LocalAiHost class abstract

The operations a platform host must provide. Implemented twice — over pigeon on Android/iOS/macOS/Windows, and over Chrome's Prompt API on web — so everything above this line is written once.

Implementers

Constructors

LocalAiHost()

Properties

events → Stream<LocalAiHostEvent>
Host events for every session, plus download progress. Broadcast: each session filters by its own id.
no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addImage({required int sessionId, required Uint8List imageBytes}) → Future<void>
addQueryChunk({required int sessionId, required String text}) → Future<void>
availabilityReason() → Future<String>
checkAvailability() → Future<LocalAiAvailability>
closeModel() → Future<void>
closeSession(int sessionId) → Future<void>
countTokens({required int sessionId, required String text}) → Future<int>
Exact count where the host has a tokenizer; throws LocalAiTokenizerUnavailable where it doesn't, so the caller decides whether to estimate.
createModel({required bool supportImage}) → Future<void>
createSession({required int sessionId, required double temperature, required int topK, double? topP, int? maxOutputTokens, String? systemInstruction, List<LocalAiTool>? tools}) → Future<void>
downloadFeature() → Future<void>
Starts the OS feature download. A failure to start is reported by throwing — LocalAi.ensureReady() fails with it instead of waiting out its timeout. The web host throws LocalAiUserActivationRequiredException outside a user gesture.
generateResponse(int sessionId, {LocalAiGenerationOverrides? overrides}) → Future<String>
generateResponseAsync(int sessionId, {LocalAiGenerationOverrides? overrides}) → Future<void>
generateStructuredResponse({required int sessionId, required String schemaJson, LocalAiGenerationOverrides? overrides}) → Future<String>
getBackendInfo() → Future<LocalAiBackendCapabilities>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openAICorePlayStore() → Future<bool>
stopGeneration(int sessionId) → Future<void>
toString() → String
A string representation of this object.
inherited

Operators

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