DefaultEmbeddingGenerationService

Wisej.AI.Services.DefaultEmbeddingGenerationService

Namespace: Wisej.AI.Services

Assembly: Wisej.AI (3.5.0.0)

Represents a service that provides functionality to generate embeddings for given text inputs using a SmartEndpoint

public class DefaultEmbeddingGenerationService : IEmbeddingGenerationService

Constructors

DefaultEmbeddingGenerationService(endpoint, vectorSize)

Initializes a new instance of the DefaultEmbeddingGenerationService class with the specified endpoint and vector size.

Name
Type
Description

endpoint

The endpoint used for embedding generation. If not specified, defaults to a new instance of OpenAIEndpoint.

vectorSize

The size of the embedding vector. Default is 1536, which corresponds to the size for "text-embedding-3-small".

Properties

Endpoint

SmartEndpoint: Gets or sets the default endpoint used for generating embeddings. (Default: Wisej.AI.Endpoints.OpenAIEndpoint)

MaxArraySize

Int32: Gets or sets the maximum number of text chunks that can be sent as an array to the provider. (Default: 512)

VectorSize

Int32: Gets or sets the dimension of the embedding vectors. (Default: 1536)

Methods

EmbedAsync(chunks)

Asynchronously generates an embedding for a given array of text chunks.

Parameter
Type
Description

chunks

An array of text strings to be embedded. Must not be null or empty.

Returns: Task<Embedding>. A task representing the asynchronous operation, with a result of type Embedding.

This method provides a way to generate embeddings for text data which can be utilized in various NLP tasks. Embeddings are numerical representations of text that capture semantic information. Applications may use embeddings for:

  • Similarity comparisons

  • Semantic searches

  • Machine learning models


  var textChunks = new[] { "Hello, world!", "C# is awesome." };
  var embeddings = await myEmbeddingService.EmbedAsync(textChunks);

Implements

Name
Description

Represents a service capable of generating embeddings from provided text chunks.

Last updated