> 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/smartendpoint/wisej.ai.endpoints.huggingfaceendpoint.md).

# HuggingFaceEndpoint

Namespace: **Wisej.AI.Endpoints**

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

* [SmartEndpoint](/ai/components/api/smartendpoint.md)
  * [SmartHttpEndpoint](/ai/components/api/smartendpoint/wisej.ai.endpoints.smarthttpendpoint.md)
    * [OpenAIEndpoint](/ai/components/api/smartendpoint/wisej.ai.endpoints.openaiendpoint.md)
      * [HuggingFaceEndpoint](/ai/components/api/smartendpoint/wisej.ai.endpoints.huggingfaceendpoint.md)

Represents a connection to HuggingFace serverless endpoints for model inference and embeddings.

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

```csharp
public class HuggingFaceEndpoint : OpenAIEndpoint
```

{% endtab %}

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

```visual-basic
Public Class HuggingFaceEndpoint
    Inherits OpenAIEndpoint
```

{% endtab %}
{% endtabs %}

This class is used to interact with HuggingFace's API for model inference and embeddings. It provides methods to construct API URLs, add options and messages to requests, and read responses.

## Constructors

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

Initializes a new instance of the [HuggingFaceEndpoint](/ai/components/api/smartendpoint/wisej.ai.endpoints.huggingfaceendpoint.md) class with default settings.

## Properties

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

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the model used for generating embeddings. (Default: `"sentence-transformers/all-MiniLM-L6-v2"`)

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

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Gets or sets the maximum number of output tokens. (Default: `2048`)

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

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the model used for inference. (Default: `"meta-llama/Llama-3.2-11B-Vision-Instruct"`)

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

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the base URL for the HuggingFace API. (Default: `"https://api-inference.huggingface.co"`)

## Methods

### ![](/files/KL0Ik37djZRr8a07Wopd) BuildEmbeddingsPayload(inputs)

Builds the payload for an embeddings request.

| Parameter  | Type                                                              | Description                                           |
| ---------- | ----------------------------------------------------------------- | ----------------------------------------------------- |
| **inputs** | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string) | The input strings for which embeddings are requested. |

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). The constructed payload object.

This method constructs the payload for an embeddings request, including options such as wait\_for\_model.

### ![](/files/KL0Ik37djZRr8a07Wopd) GetApiURL()

Constructs the API URL for model inference.

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). The constructed API URL.

### ![](/files/KL0Ik37djZRr8a07Wopd) GetEmbeddingsURL()

Constructs the API URL for embeddings.

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). The constructed embeddings URL.

### ![](/files/KL0Ik37djZRr8a07Wopd) ReadEmbeddingsResponse(response)

Reads the embeddings from the API response.

| Parameter    | Type                                                                            | Description                                 |
| ------------ | ------------------------------------------------------------------------------- | ------------------------------------------- |
| **response** | [Response](/ai/components/api/smartendpoint/wisej.ai.smartendpoint.response.md) | The API response containing the embeddings. |

**Returns:** [Single\[\]\[\]](https://docs.microsoft.com/dotnet/api/system.single). A two-dimensional array of floats representing the embeddings.

This method parses the response to extract the embeddings data.


---

# 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:

```
GET https://docs.wisej.com/ai/components/api/smartendpoint/wisej.ai.endpoints.huggingfaceendpoint.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
