DesktopEmbeddingModel class
Desktop implementation of EmbeddingModel using TFLite C API via dart:ffi.
Loads a .tflite embedding model directly in the Dart process (no gRPC).
Auto-detects sequence length and embedding dimension from the model.
Pipeline: text → tokenize → add BOS/EOS → pad → Int32 tensor → invoke → Float32 embedding
- Inheritance
-
- Object
- EmbeddingModel
- DesktopEmbeddingModel
Constructors
-
DesktopEmbeddingModel({required TfLiteInterpreter interpreter, required List<
int> tokenize(String text), required VoidCallback onClose})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- onClose → VoidCallback
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
tokenize
→ List<
int> Function(String text) -
Tokenization function: text → list of token IDs.
Injected to decouple model from tokenizer implementation.
final
Methods
-
close(
) → Future< void> -
Close the embedding model and release resources.
override
-
generateEmbedding(
String text, {TaskType taskType = TaskType.retrievalQuery}) → Future< List< double> > -
Generate embedding vector for given text.
override
-
generateEmbeddings(
List< String> texts, {TaskType taskType = TaskType.retrievalQuery}) → Future<List< List< >double> > -
Generate embedding vectors for multiple texts.
override
-
getDimension(
) → Future< int> -
Get the dimension of embedding vectors generated by this model.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited