Class: LlamaEmbedding
Constructors
new LlamaEmbedding()
ts
new LlamaEmbedding(options: LlamaEmbeddingOptions): LlamaEmbedding
Parameters
Parameter | Type |
---|---|
options | LlamaEmbeddingOptions |
Returns
Defined in
evaluator/LlamaEmbedding.ts:13
Properties
vector
ts
readonly vector: readonly number[];
Defined in
evaluator/LlamaEmbedding.ts:11
Methods
toJSON()
ts
toJSON(): LlamaEmbeddingJSON
Returns
Defined in
evaluator/LlamaEmbedding.ts:17
calculateCosineSimilarity()
ts
calculateCosineSimilarity(other: readonly number[] | LlamaEmbeddingJSON | LlamaEmbedding): number
Calculates the cosine similarity between this embedding and another embedding.
Note that you should only compare embeddings created by the exact same model file.
Parameters
Parameter | Type |
---|---|
other | readonly number [] | LlamaEmbeddingJSON | LlamaEmbedding |
Returns
number
A value between 0 and 1 representing the similarity between the embedding vectors, where 1 means the embeddings are identical.
Defined in
evaluator/LlamaEmbedding.ts:31
fromJSON()
ts
static fromJSON(json: LlamaEmbeddingJSON): LlamaEmbedding
Parameters
Parameter | Type |
---|---|
json | LlamaEmbeddingJSON |