> 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/wisej.ai.services.defaultembeddinggenerationservice.md).

# 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](/ai/components/api/smartendpoint.md)

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

```csharp
public class DefaultEmbeddingGenerationService : IEmbeddingGenerationService
```

{% endtab %}

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

```visual-basic
Public Class DefaultEmbeddingGenerationService
    Inherits IEmbeddingGenerationService
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](/files/ptrKjmmRoQB76pvrIqh0) DefaultEmbeddingGenerationService(endpoint, vectorSize)

Initializes a new instance of the [DefaultEmbeddingGenerationService](/ai/components/api/services/iembeddinggenerationservice/wisej.ai.services.defaultembeddinggenerationservice.md) class with the specified endpoint and vector size.

| Name           | Type                                                        | Description                                                                                                                                                                          |
| -------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **endpoint**   | [SmartEndpoint](/ai/components/api/smartendpoint.md)        | The endpoint used for embedding generation. If not specified, defaults to a new instance of [OpenAIEndpoint](/ai/components/api/smartendpoint/wisej.ai.endpoints.openaiendpoint.md). |
| **vectorSize** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) | The size of the embedding vector. Default is 1536, which corresponds to the size for "text-embedding-3-small".                                                                       |

## Properties

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

[SmartEndpoint](/ai/components/api/smartendpoint.md): Gets or sets the default endpoint used for generating embeddings. (Default: `Wisej.AI.Endpoints.OpenAIEndpoint`)

### ![](/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. (Default: `512`)

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

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

## Methods

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

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

| Parameter  | Type                                                              | Description                                                         |
| ---------- | ----------------------------------------------------------------- | ------------------------------------------------------------------- |
| **chunks** | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string) | An array of text strings to be embedded. Must not be null or 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 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

```csharp

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

```

## Implements

| Name                                                                                      | Description                                                                      |
| ----------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| [IEmbeddingGenerationService](/ai/components/api/services/iembeddinggenerationservice.md) | Represents a service capable of generating embeddings from provided text chunks. |


---

# 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/wisej.ai.services.defaultembeddinggenerationservice.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.
