OpenAIEndpoint
Wisej.AI.Endpoints.OpenAIEndpoint
Namespace: Wisej.AI.Endpoints
Assembly: Wisej.AI (3.5.0.0)
Represents an endpoint for connecting to OpenAI services.
public class OpenAIEndpoint : SmartHttpEndpoint
This class is used to interact with OpenAI's API, providing methods to send requests and process responses for both chat completions and embeddings.
Constructors
OpenAIEndpoint()

Initializes a new instance of the OpenAIEndpoint class with default settings.
The default authentication is set to "Bearer".
Properties
EmbeddingModel

String: Gets or sets the model used for embeddings. (Default: "text-embedding-3-small"
)
Model

String: Gets or sets the model used for chat completions. (Default: "gpt-4o"
)
URL

String: Gets or sets the base URL for the OpenAI API. (Default: "https://api.openai.com/v1"
)
UseNativeTools

Boolean: (Default: True
)
Methods
AddOptions(message, session)

Adds options to the message for the API request.
Sets the temperature to 0.0 and max tokens to the value of MaxOutputTokens.
BuildEmbeddingsPayload(inputs)

Builds the payload for an embeddings request.
Returns: Object. The constructed payload for the embeddings request.
Throws:
ArgumentNullException Thrown when the inputs are null.
BuildMessage(message)

Builds the message payload for the API request.
Returns: Object. The constructed message payload.
Throws:
ArgumentNullException Thrown when the message is null.
GetApiURL()

Constructs the API URL for chat completions.
Returns: String. The full API URL for chat completions.
GetEmbeddingsURL()

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

Reads the embeddings from the API response.
Returns: Single[][]. An array of float arrays representing the embeddings.
Throws:
ArgumentNullException Thrown when the response is null.
Inherited By
Represents a connection to Cerebras endpoints, inheriting from OpenAIEndpoint.
Represents a connection to DeepSeek endpoints, inheriting from OpenAIEndpoint.
https://console.groq.com/docs/openai
Represents a connection to HuggingFace serverless endpoints for model inference and embeddings.
Represents a connection to LocalAI endpoints, providing access to various AI models and services.
Represents a connection to NVIDIA AI endpoints, providing access to various AI models and services.
Represents a connection to SambaNova endpoints, inheriting from OpenAIEndpoint.
Represents a connection to TogetherAI endpoints, providing access to various AI models and services.
Represents a connection to X.AI endpoints, extending the functionality of OpenAIEndpoint.
Last updated