Skip to main content

LocalAIEndpointWhisper

Namespace: Wisej.AI.Endpoints

Assembly: Wisej.AI

Represents an endpoint for connecting to LocalAI's Whisper model for speech-to-text transcriptions.

public class LocalAIEndpointWhisper : SmartHttpEndpoint

This class is designed to interact with LocalAI's Whisper model, providing functionality to send audio data and receive transcriptions. It extends the SmartHttpEndpoint to leverage HTTP communication.

Constructors​

LocalAIEndpointWhisper()​

Initializes a new instance of the LocalAIEndpointWhisper class with default settings.

Sets the authentication method to "Bearer", the model to "whisper-1", and the response format to "text". The URL is set to LocalAI's audio transcription endpoint.

Properties​

Model​

String: Gets or sets the model used for transcription. (Default: "whisper-1")

URL​

String: Gets or sets the URL for the LocalAI audio transcription endpoint. (Default: "http://localhost:8080/v1/audio/transcriptions")

Methods​

AddMessages(payload, session, messages)​

Adds user messages to the payload for the request.

ParameterTypeDescription
payloadObjectThe payload to which messages will be added.
sessionSmartSessionThe current session containing user data.
messagesIList<Message>The list of messages to be processed.

Throws:

CreateContent(data)​

Creates the HTTP content for the request using the provided data.

ParameterTypeDescription
dataObjectThe data to be included in the request content.

Returns: HttpContent. A HttpContent object containing the request data.

ReadAssistantMessage(response, message)​

Reads the assistant's message from the response and updates the message object.

ParameterTypeDescription
responseResponseThe response received from the server.
messageMessageThe message object to be updated with the assistant's reply.

Throws:

ReadUsage(message, reply)​

Reads the usage information from the reply. Not supported in this implementation.

ParameterTypeDescription
messageMessageThe message object to be updated with usage information.
replyObjectThe reply containing usage data.