> For the complete documentation index, see [llms.txt](https://docs.wisej.com/ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/ai/components/api/services/iembeddinggenerationservice.md).

# IEmbeddingGenerationService

Namespace: **Wisej.AI.Services**

Assembly: **Wisej.AI** (3.5.0.0)

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

{% tabs %}
{% tab title="C#" %}

```csharp
public interface IEmbeddingGenerationService
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Interface IEmbeddingGenerationService
```

{% endtab %}
{% endtabs %}

## Properties

### ![](/files/ptrKjmmRoQB76pvrIqh0) Endpoint

[SmartEndpoint](/ai/components/api/smartendpoint.md): Gets or sets the endpoint configuration for the embedding generation service.

### ![](/files/ptrKjmmRoQB76pvrIqh0) MaxArraySize

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Gets or sets the maximum number of text chunks that can be sent as an array to the provider.

### ![](/files/ptrKjmmRoQB76pvrIqh0) VectorSize

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Gets or sets the dimension of the embedding vectors.

## Methods

### ![](/files/ptrKjmmRoQB76pvrIqh0) EmbedAsync(chunks)

Asynchronously generates an embedding from the specified array of text chunks.

| Parameter  | Type                                                              | Description                                                                              |
| ---------- | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| **chunks** | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string) | An array of strings representing the text chunks to be embedded. The array can be empty. |

**Returns:** [Task\<Embedding>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task representing the asynchronous operation, with a result of type [Embedding](/ai/components/api/embeddings/wisej.ai.embeddings.embedding.md).

This method processes the supplied text chunks and returns an embedding that captures the semantic information contained within the text.\
Usage example:

```csharp

  IEmbeddingGenerationService embeddingService = new EmbeddingGenerationServiceImplementation();
  embeddingService.Endpoint = new SmartEndpoint("http://example.com/api");
  string[] textChunks = { "This is a sample text.", "Another piece of text." };
  Embedding result = await embeddingService.EmbedAsync(textChunks);

```

Note that the quality and characteristics of the generated embedding depend on the implementation details of the embedding service.

## Implemented By

| Name                                                                                                                                                        | Description                                                                                                                                                |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [DefaultEmbeddingGenerationService](/ai/components/api/services/iembeddinggenerationservice/wisej.ai.services.defaultembeddinggenerationservice.md)         | Represents a service that provides functionality to generate embeddings for given text inputs using a [SmartEndpoint](/ai/components/api/smartendpoint.md) |
| [HuggingFaceEmbeddingGenerationService](/ai/components/api/services/iembeddinggenerationservice/wisej.ai.services.huggingfaceembeddinggenerationservice.md) | Represents a service for generating embeddings using the Hugging Face API.                                                                                 |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wisej.com/ai/components/api/services/iembeddinggenerationservice.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
