EmbeddedKalanDB class
A KalanDB paired with a TextEmbedder so callers can search by raw text: the query is embedded on-device, then hybrid-searched in one call.
final db = await EmbeddedKalanDB.open(
dbPath: '.../textbooks.vdb',
modelPath: '.../model_quantized.onnx',
vocabPath: '.../vocab.txt',
);
final hits = await db.search('how to solve a quadratic equation');
Properties
- db → KalanDB
-
The underlying database (also usable directly for keyword-only search).
final
- embedder → TextEmbedder
-
The on-device query embedder.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → Future< void> - Closes the database and releases the embedding session.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
search(
String text, {int topK = 10, SearchMode mode = SearchMode.hybrid, double alpha = 0.7, MetadataFilter? filter}) → Future< List< SearchResult> > -
Embeds
texton-device, then runs a search. In hybrid/vector modes the embedding is used as the query vector;textis also passed for BM25. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
open(
{required String dbPath, required String modelPath, required String vocabPath, KalanDBConfig? config, int dimension = 384, Pooling pooling = Pooling.cls, String queryInstruction = TextEmbedder.bgeQueryInstruction, int maxSeqLen = 256}) → Future< EmbeddedKalanDB> - Opens the database and loads the embedding model + vocab.