SyniRuntime class
Async, isolate-backed wrapper around libsyni_ffi.
All inference calls run on a dedicated worker isolate so the caller (UI) isolate is never blocked. Initialize once, load a model, then issue any number of run calls.
Breaking change from v1.0: run is now asynchronous. Previous code like:
final r = runtime.run(req);
must become:
final r = await runtime.run(req);
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isInitialized → bool
-
no setter
- modelPath → String?
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → Future< void> - Free the engine and terminate the worker isolate. The instance can be re-initialized after dispose by calling initialize again.
-
downloadModel(
String url, {String? filename}) → Future< String> -
Download a GGUF model from
urlinto the app's documents directory. -
getVersion(
) → Future< String?> -
Runtime semver, or
nullif the call failed. -
initialize(
) → Future< void> - Spawn the worker isolate. Safe to call multiple times.
-
loadModel(
String modelPath) → Future< bool> - Load a GGUF model file. Idempotent for the same path; replaces the model on the existing engine when called with a different path.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run(
SyniRuntimeRequest request, {SyniPreset preset = SyniPreset.chat, int seed = 0}) → Future< SyniRuntimeResponse> - Run a single inference.
-
runStream(
SyniRuntimeRequest request, {SyniPreset preset = SyniPreset.chat, int seed = 0}) → Stream< SyniRuntimeStreamChunk> - Run inference and stream token chunks as they are generated.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited