OllamaEndpoint
Wisej.AI.Endpoints.OllamaEndpoint
Last updated
Wisej.AI.Endpoints.OllamaEndpoint
Last updated
Namespace: Wisej.AI.Endpoints
Assembly: Wisej.AI (3.5.0.0)
Represents an endpoint that connects to Ollama services, providing functionalities for chat and embeddings.
This class extends the to interact with Ollama endpoints. It provides methods to construct API URLs, add options to messages, and handle responses.
Initializes a new instance of the class with default settings.
: Gets or sets the embedding model used by the endpoint. (Default: "all-minilm"
)
Adds options to the message for the current session.
message
The dynamic message object to which options are added.
session
The current session containing model options.
Throws:
Asynchronously requests embeddings for the specified inputs.
inputs
An array of input strings for which embeddings are requested.
Throws:
Builds the payload for the embeddings request.
inputs
An array of input strings for which the payload is built.
Throws:
Constructs the API URL for chat interactions.
Constructs the API URL for embeddings interactions.
Reads the assistant's message from the response and updates the message object.
response
The response received from the API.
message
The message object to be updated with the assistant's response.
Throws:
Reads the embeddings response and extracts the embeddings data.
response
The response received from the API.
Throws:
Reads the usage statistics from the reply and updates the message usage.
message
The message object to be updated with usage statistics.
reply
The dynamic reply object containing usage information.
: Gets or sets the maximum number of tokens the context window for the specified can hold. (Default: 8192
)
Thrown when the message is null.
Returns: . A task representing the asynchronous operation, with a result of type .
Thrown when the inputs are null.
Returns: . An object representing the payload for the embeddings request.
Thrown when the inputs are null.
Returns: . A string representing the chat API URL.
Returns: . A string representing the embeddings API URL.
Thrown when the response or message is null.
Returns: . A jagged array of floats representing the embeddings.
Thrown when the response is null.