Skip to main content
All docs
V24.2

GenerateImageDescriptionRequest(String, String) Constructor

Initializes a new instance of the GenerateImageDescriptionRequest class with specified settings.

Namespace: DevExpress.AIIntegration.Extensions

Assembly: DevExpress.AIIntegration.v24.2.dll

NuGet Package: DevExpress.AIIntegration

Declaration

public GenerateImageDescriptionRequest(
    string base64ImageData,
    string imageFormat = null
)

Parameters

Name Type Description
base64ImageData String

The Base64 image. This value is assigned to the Base64ImageData property.

Optional Parameters

Name Type Default Description
imageFormat String null

The image format. This value is assigned to the ImageFormat property.

Remarks

The following example registers an Azure OpenAI client to use the AI-powered extension in an .NET Console application to generate a description for the following image:

Toolbar with File menu and various document actions.

using Azure;
using Azure.AI.OpenAI;
using Microsoft.Extensions.AI;
using DevExpress.AIIntegration;
using DevExpress.AIIntegration.Extensions;

SetEnvironmentVariables();

// Register an Azure OpenAI client
AIExtensionsContainerDefault defaultAIExtensionsContainer = RegisterAzureOpenAIClient(
    Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT"),
    Environment.GetEnvironmentVariable("AZURE_OPENAI_APIKEY")
);

string imageBase64 = "iVBORw0KGgoAAAANSUhEUgAABhgAAAF+CAMAAABHxuB6AAAABGdBTUEAALGPC...";
var response = await defaultAIExtensionsContainer.GenerateImageDescriptionAsync(
    new GenerateImageDescriptionRequest(imageBase64)
);

Console.WriteLine(response);

/* Output:
 * Toolbar with File menu and various document actions.
 */

AIExtensionsContainerDefault RegisterAzureOpenAIClient(string azureOpenAIEndpoint, string azureOpenAIKey) {
    IChatClient client = new AzureOpenAIClient(
        new Uri(azureOpenAIEndpoint),
        new AzureKeyCredential(azureOpenAIKey))
            .AsChatClient("gpt-4o-mini");
    return AIExtensionsContainerConsole.CreateDefaultAIExtensionContainer(client);
}

void SetEnvironmentVariables() {
    Environment.SetEnvironmentVariable("AZURE_OPENAI_ENDPOINT", {SPECIFY_YOUR_AZURE_ENDPOINT});
    Environment.SetEnvironmentVariable("AZURE_OPENAI_APIKEY", {SPECIFY_YOU_AZURE_KEY});
}
See Also