Embedding class
Represents a document's embedding vector
Constructors
-
Embedding(List<
double> vector) - Embedding.fromBase64(String base64Str)
-
Create embedding from base64 string
factory
-
Embedding.fromBinary(List<
int> data) -
Create embedding from binary format
factory
- Embedding.fromJson(List json)
-
Create an embedding from JSON
factory
Properties
Methods
-
cosineSimilarity(
Embedding other) → double - Calculate cosine similarity with another embedding
-
dotProduct(
Embedding other) → double - Calculate dot product with another embedding
-
euclideanDistance(
Embedding other) → double - Calculate Euclidean distance with another embedding
-
normalize(
) → Embedding - Normalize the embedding vector (L2 normalization)
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toBase64(
) → String - Encode embedding to base64 string
-
toBinary(
) → List< int> - Encode embedding to binary format
-
toJson(
) → List< double> - Convert embedding to JSON
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited