initialize static method
Initialize LiteRT embeddings with model and tokenizer paths.
Must be called before generating embeddings.
modelPath - Path to .tflite model file
tokenizerPath - Path to sentencepiece.model file
wasmPath - Optional path to WASM files (defaults to /node_modules/@litertjs/core/wasm/)
Note: Sequence length is auto-detected from model input shape (like iOS/Android)
Throws Exception if initialization fails
Implementation
static Future<void> initialize(
String modelPath,
String tokenizerPath, {
String? wasmPath,
}) async {
try {
await _loadLiteRtEmbeddingsJS(
modelPath.toJS,
tokenizerPath.toJS,
wasmPath?.toJS,
).toDart;
} catch (e) {
throw Exception('Failed to initialize LiteRT embeddings: $e');
}
}