OpenAIEndpointWhisper
Namespace: Wisej.AI.Endpoints
Assembly: Wisej.AI
Represents an endpoint for connecting to OpenAI's Whisper model for speech-to-text transcriptions.
- C#
- VB.NET
public class OpenAIEndpointWhisper : SmartHttpEndpoint
Public Class OpenAIEndpointWhisper
Inherits SmartHttpEndpoint
This class is designed to interact with OpenAI's Whisper model, providing functionality to send audio data and receive transcriptions. It extends the SmartHttpEndpoint to leverage HTTP communication.
Constructors
OpenAIEndpointWhisper()
Initializes a new instance of the OpenAIEndpointWhisper 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 OpenAI'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 OpenAI audio transcription endpoint. (Default: "https://api.openai.com/v1/audio/transcriptions")
Methods
AddMessages(payload, session, messages)
Adds user messages to the payload for the request.
| Parameter | Type | Description |
|---|---|---|
| payload | Object | The payload to which messages will be added. |
| session | SmartSession | The current session containing user data. |
| messages | IList<Message> | The list of messages to be processed. |
Throws:
- ArgumentNullException Thrown if any of the parameters are null.
CreateContent(data)
Creates the HTTP content for the request using the provided data.
| Parameter | Type | Description |
|---|---|---|
| data | Object | The 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.
| Parameter | Type | Description |
|---|---|---|
| response | Response | The response received from the server. |
| message | Message | The message object to be updated with the assistant's reply. |
Throws:
- ArgumentNullException Thrown if any of the parameters are null.
ReadUsage(message, reply)
Reads the usage information from the reply. Not supported in this implementation.
| Parameter | Type | Description |
|---|---|---|
| message | Message | The message object to be updated with usage information. |
| reply | Object | The reply containing usage data. |