HuggingFaceEndpoint
Wisej.AI.Endpoints.HuggingFaceEndpoint
Namespace: Wisej.AI.Endpoints
Assembly: Wisej.AI (3.5.0.0)
Represents a connection to HuggingFace serverless endpoints for model inference and embeddings.
public class HuggingFaceEndpoint : OpenAIEndpoint
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
HuggingFaceEndpoint()

Initializes a new instance of the HuggingFaceEndpoint class with default settings.
Properties
EmbeddingModel

String: Gets or sets the model used for generating embeddings. (Default: "sentence-transformers/all-MiniLM-L6-v2"
)
MaxOutputTokens

Int32: Gets or sets the maximum number of output tokens. (Default: 2048
)
Model

String: Gets or sets the model used for inference. (Default: "meta-llama/Llama-3.2-11B-Vision-Instruct"
)
URL

String: Gets or sets the base URL for the HuggingFace API. (Default: "https://api-inference.huggingface.co"
)
Methods
BuildEmbeddingsPayload(inputs)

Builds the payload for an embeddings request.
Returns: Object. The constructed payload object.
This method constructs the payload for an embeddings request, including options such as wait_for_model.
GetApiURL()

Constructs the API URL for model inference.
Returns: String. The constructed API URL.
GetEmbeddingsURL()

Constructs the API URL for embeddings.
Returns: String. The constructed embeddings URL.
ReadEmbeddingsResponse(response)

Reads the embeddings from the API response.
Returns: Single[][]. A two-dimensional array of floats representing the embeddings.
This method parses the response to extract the embeddings data.
Last updated