Skip to main content

LocalAIEndpointImageGen

Namespace: Wisej.AI.Endpoints

Assembly: Wisej.AI

Represents an endpoint for connecting to LocalAI Image Generation services.

public class LocalAIEndpointImageGen : SmartHttpEndpoint

This class is used to interact with the LocalAI DallE API for generating images. It sets up the necessary authentication and model parameters required for the API requests.

Constructors

LocalAIEndpointImageGen()

Initializes a new instance of the LocalAIEndpointImageGen class.

Sets default values for authentication, model, and URL specific to the DallE API.

Properties

Model

String: Gets or sets the model used for the DallE API. (Default: "dall-e-3")

URL

String: Gets or sets the URL for the DallE API endpoint. (Default: "https://api.LocalAI.com/v1/images/generations")

Methods

AddMessages(payload, session, messages)

Adds user messages to the payload for the API request.

ParameterTypeDescription
payloadObjectThe dynamic payload object to be sent to the API.
sessionSmartSessionThe current session containing user context.
messagesIList<Message>The list of messages to be processed.

Throws:

ReadAssistantMessage(response, message)

Reads the assistant's message from the API response.

ParameterTypeDescription
responseResponseThe response received from the API.
messageMessageThe message object to populate with the response data.

Parses the response to extract image URLs or base64 encoded images and assigns them to the message. Throws:

ReadUsage(message, reply)

Reads the usage information from the API response.

ParameterTypeDescription
messageMessageThe message object to populate with usage data.
replyObjectThe dynamic reply object containing the response data.

This method does not process usage information as it is not returned by the API.