Skip to main content

SmartPictureBoxAdapter

Namespace: Wisej.AI.Adapters

Assembly: Wisej.AI

Represents an adapter for a PictureBox that generates images based on a description using the OpenAI DALL-E endpoint.

public class SmartPictureBoxAdapter : SmartAdapter

This adapter extends the functionality of a PictureBox by allowing it to generate images from text descriptions. It works with the OpenAI DALL-E endpoint and supports different image formats and sizes.

Constructors​

SmartPictureBoxAdapter()​

Initializes a new instance of SmartPictureBoxAdapter.

Properties​

ImageFormat​

String: Gets or sets the format in which the generated images are returned. Must be one of "url" or "b64_json". (Default: "url")

ImageSize​

String: Gets or sets the size of the generated images. Must be one of "256x256", "512x512", or "1024x1024". Smaller images are faster. (Default: "1024x1024")

For DALL-E-2, image sizes must be one of "256x256", "512x512", or "1024x1024". When using DALL-E-3, images can have a size of 1024x1024, 1024x1792, or 1792x1024 pixels.

Methods​

OnControlCreated(control)​

Handles the event when the control is created.

ParameterTypeDescription
controlControlThe control that was created.

OnControlDisposed(control)​

Handles the event when the control is disposed.

ParameterTypeDescription
controlControlThe control that was disposed.

RunAsyncCore(control)​

Asynchronously runs the core logic for generating an image based on the control's text.

ParameterTypeDescription
controlControlThe control containing the text description.

Returns: Task<Message>. A task representing the asynchronous operation, with a Message result containing the generated image or image URL.

Throws:

Implements​

NameDescription
IToolProviderRepresents a provider that supplies tools.