DartBridgeLLM class

LLM component bridge for C++ interop.

Provides access to the C++ LLM component. Handles model loading, generation, and lifecycle.

Matches Swift's CppBridge.LLM actor pattern.

Usage:

final llm = DartBridgeLLM.shared;
await llm.loadModel('/path/to/model.gguf', 'model-id', 'Model Name');
final result = await llm.generate('Hello', maxTokens: 100);

Properties

currentModelId String?
Get the currently loaded model ID.
no setter
hashCode int
The hash code for this object.
no setterinherited
isLoaded bool
Check if a model is loaded.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
supportsStreaming bool
Check if streaming is supported.
no setter

Methods

cancel() → void
Cancel ongoing generation.
cancelGeneration() → void
Cancel any active generation
destroy() → void
Destroy the component and release resources.
generate(String prompt, {int maxTokens = 512, double temperature = 0.7, String? systemPrompt}) Future<LLMComponentResult>
Generate text from a prompt.
generateStream(String prompt, {int maxTokens = 512, double temperature = 0.7, String? systemPrompt}) Stream<String>
Generate text with streaming.
getHandle() RacHandle
Get or create the LLM component handle.
loadModel(String modelPath, String modelId, String modelName) Future<void>
Load an LLM model.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setActiveStreamSubscription(StreamSubscription<String>? sub) → void
Set active stream subscription for cancellation
toString() String
A string representation of this object.
inherited
unload() → void
Unload the current model.

Operators

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

Static Properties

shared DartBridgeLLM
Shared instance
final