HuggingFaceEmbeddingGenerationService
Wisej.AI.Services.HuggingFaceEmbeddingGenerationService
Namespace: Wisej.AI.Services
Assembly: Wisej.AI (3.5.0.0)
Represents a service for generating embeddings using the Hugging Face API.
public class HuggingFaceEmbeddingGenerationService : IEmbeddingGenerationService
This class implements the IEmbeddingGenerationService interface and provides methods to generate embeddings from text chunks using the Hugging Face API.
Constructors
HuggingFaceEmbeddingGenerationService(url)

Initializes a new instance of the HuggingFaceEmbeddingGenerationService class with an optional URL.
Properties
MaxArraySize

Int32: Gets or sets the maximum size of the array that can be processed in a single request. (Default: 100
)
URL

String: Gets or sets the base URL of the Hugging Face API. (Default: null
)
VectorSize

Int32: Gets or sets the size of the vector for the embeddings. This property is not used. (Default: 0
)
Methods
EmbedAsync(chunks)

Asynchronously generates embeddings for the provided text chunks.
Returns: Task<Embedding>. A task that represents the asynchronous operation. The task result contains the generated Embedding.
This method handles chunking of input data and parallelizes requests if necessary. It combines results from multiple requests if the input exceeds the maximum array size.
var service = new HuggingFaceEmbeddingGenerationService("http://api.example.com");
var embedding = await service.EmbedAsync(new string[] { "text1", "text2" });
Implements
Represents a service capable of generating embeddings from provided text chunks.
Last updated