Table of Contents

Class Embedder

Namespace
LMKit.Embeddings
Assembly
LM-Kit.NET.dll

A class designed for generating embeddings from text and image. It facilitates execution of tasks related to natural language and coding, such as semantic search, clustering, topic modeling, and classification. Supports embeddings from:

  • Plain text strings
  • Tokenized text
  • File attachments (e.g. images like PNG, JPEG, TIFF, and documents like TXT, HTML) when the underlying model provides image‑embedding capabilities.
public sealed class Embedder
Inheritance
Embedder
Inherited Members

Constructors

Embedder(LM)

Initializes a new instance of the Embedder class.

Properties

Model

Gets the LM instance associated with this object.

Methods

GetCosineSimilarity(IList<float>, IList<float>)

Calculates the cosine similarity between two embedding vectors, representing the cosine of the angle between them in a multidimensional space.

GetEmbeddings(Attachment, CancellationToken)

Generates the embedding vector for a given file attachment. If the associated LM supports image embeddings, image attachments (for example, PNG, JPEG, TIFF) will be processed into embeddings; otherwise, text‑based attachments (for example, TXT, HTML) will be used.

GetEmbeddings(IEnumerable<IList<int>>, CancellationToken)

Generates embedding vectors for a collection of tokenized texts. Each vector represents a text in a high-dimensional space, enabling various natural language processing tasks by capturing semantic meaning.

GetEmbeddings(IEnumerable<string>, CancellationToken)

Generates embedding vectors for a collection of text strings. Each vector represents a text in a high-dimensional space, enabling various natural language processing tasks by capturing semantic meaning.

GetEmbeddings(IList<int>, CancellationToken)

Generates the embedding vector for a given tokenized text. This vector represents the text in a high-dimensional space, enabling various natural language processing tasks by capturing semantic meaning.

GetEmbeddings(string, CancellationToken)

Generates the embedding vector for a given text string. This vector represents the text in a high-dimensional space, enabling various natural language processing tasks by capturing semantic meaning.

GetEmbeddingsAsync(Attachment, CancellationToken)

Asynchronously generates the embedding vector for a given file attachment. If the associated LM supports image embeddings, image attachments (for example, PNG, JPEG, TIFF) will be processed into embeddings; otherwise, text‑based attachments (for example, TXT, HTML) will be used.

GetEmbeddingsAsync(IEnumerable<IList<int>>, CancellationToken)

Asynchronously generates embedding vectors for a collection of tokenized texts. Each vector represents a text in a high-dimensional space, enabling various natural language processing tasks by capturing semantic meaning.

GetEmbeddingsAsync(IEnumerable<string>, CancellationToken)

Asynchronously generates embedding vectors for a collection of text strings. Each vector represents a text in a high-dimensional space, enabling various natural language processing tasks by capturing semantic meaning.

GetEmbeddingsAsync(IList<int>, CancellationToken)

Asynchronously generates the embedding vector for a given tokenized text. This vector represents the text in a high-dimensional space, enabling various natural language processing tasks by capturing semantic meaning.

GetEmbeddingsAsync(string, CancellationToken)

Asynchronously generates the embedding vector for a given text string. This vector represents the text in a high-dimensional space, enabling various natural language processing tasks by capturing semantic meaning.