HuggingFaceJavaScriptEndpoint
Wisej.AI.Endpoints.HuggingFaceJavaScriptEndpoint
Last updated
Wisej.AI.Endpoints.HuggingFaceJavaScriptEndpoint
Last updated
Namespace: Wisej.AI.Endpoints
Assembly: Wisej.AI (3.5.0.0)
Represents an endpoint that uses the transformers.js module in the user's browser to provide AI services to Wisej.AI components.
This class is part of the SmartEndpoint category and is designed to interact with the Hugging Face transformers.js library. It provides various AI services such as text generation, translation, and more, by utilizing different pipelines.
Initializes a new instance of the .
: Gets the unique identifier for the component.
Asynchronously processes a list of messages and returns a response message.
session
The current smart session.
messages
A list of messages to process.
Throws:
Releases the unmanaged resources used by the component and optionally releases the managed resources.
disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Asynchronously calculates the similarity between a query and an array of text.
query
The query string to compare.
text
An array of text strings to compare against the query.
Reads the assistant message from the response and updates the message.
response
The response containing the assistant message.
message
The message to update with the assistant's response.
Throws:
Reads the usage information from the reply and updates the message.
message
The message to update with usage information.
reply
The reply containing usage information.
: Gets or sets the model used by the endpoint. (Default: null
)
: Gets or sets the pipeline used by the endpoint. (Default: None
)
The pipeline determines the type of AI service provided, such as translation or text generation.
: Gets or sets the subtask for the selected pipeline. (Default: ""
)
This property allows further specification of the task within the chosen pipeline.
: Gets or sets the source URL for the transformers.js library. (Default: "https://cdn.jsdelivr.net/npm/@xenova/transformers"
)
Returns: . A task that represents the asynchronous operation. The task result contains the response message.
Thrown when session or messages is null.
Thrown when the pipeline is not supported.
Returns: . A task that represents the asynchronous operation. The task result contains an array of similarity scores.
Thrown when response or message is null.