Skip to content

LLamaEmbedder

Namespace: LLama

The embedder for LLama, which supports getting embeddings from text.

public sealed class LLamaEmbedder : System.IDisposable

Inheritance ObjectLLamaEmbedder
Implements IDisposable

Properties

EmbeddingSize

Dimension of embedding vectors

public int EmbeddingSize { get; }

Property Value

Int32

Constructors

LLamaEmbedder(IModelParams)

public LLamaEmbedder(IModelParams params)

Parameters

params IModelParams

LLamaEmbedder(LLamaWeights, IModelParams)

public LLamaEmbedder(LLamaWeights weights, IModelParams params)

Parameters

weights LLamaWeights

params IModelParams

Methods

GetEmbeddings(String, Int32, Boolean, String)

Caution

'threads' and 'encoding' parameters are no longer used


Get the embeddings of the text.

public Single[] GetEmbeddings(string text, int threads, bool addBos, string encoding)

Parameters

text String

threads Int32
unused

addBos Boolean
Add bos to the text.

encoding String
unused

Returns

Single[]

Exceptions

RuntimeError

GetEmbeddings(String)

Get the embeddings of the text.

public Single[] GetEmbeddings(string text)

Parameters

text String

Returns

Single[]

Exceptions

RuntimeError

GetEmbeddings(String, Boolean)

Get the embeddings of the text.

public Single[] GetEmbeddings(string text, bool addBos)

Parameters

text String

addBos Boolean
Add bos to the text.

Returns

Single[]

Exceptions

RuntimeError

Dispose()

public void Dispose()