Back to Devexpress

AIExtensionsContainerDesktop.Default Field

corelibraries-devexpress-dot-aiintegration-dot-aiextensionscontainerdesktop-918c9ab8.md

latest5.0 KB
Original Source

AIExtensionsContainerDesktop.Default Field

The default container for AI services.

Namespace : DevExpress.AIIntegration

Assembly : DevExpress.AIIntegration.Desktop.v25.2.dll

NuGet Package : DevExpress.AIIntegration.Desktop

Declaration

csharp
public static readonly AIExtensionsContainerDefault Default
vb
Public Shared ReadOnly Default As AIExtensionsContainerDefault

Field Value

TypeDescription
AIExtensionsContainerDefault

The default container.

|

Remarks

The following code snippet registers an Azure OpenAI client in a WinForms application:

csharp
using Microsoft.Extensions.AI;
using DevExpress.AIIntegration;

internal static class Program {
    [STAThread]
    static void Main() {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);

        IChatClient azureChatClient = new Azure.AI.OpenAI.AzureOpenAIClient(new Uri(AzureOpenAIEndpoint),
        new System.ClientModel.ApiKeyCredential(AzureOpenAIKey))
        .GetChatClient("gpt-4o-mini").AsIChatClient();

        AIExtensionsContainerDesktop.Default.RegisterChatClient(azureChatClient);

        Application.Run(new Form1());
    }
    static string AzureOpenAIEndpoint { get { return Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT"); } }
    static string AzureOpenAIKey { get { return Environment.GetEnvironmentVariable("AZURE_OPENAI_APIKEY"); } }
}
vb
using Microsoft.Extensions.AI;
using DevExpress.AIIntegration;

internal static class Program {
    [STAThread]
    static void Main() {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Dim azureChatClient As IChatClient = New Azure.AI.OpenAI.AzureOpenAIClient(New Uri(AzureOpenAIEndpoint),
            New System.ClientModel.ApiKeyCredential(AzureOpenAIKey)).
            GetChatClient("gpt-4o-mini").AsIChatClient()

        AIExtensionsContainerDesktop.Default.RegisterChatClient(azureChatClient)
        Application.Run(new Form1());
    }
    static string AzureOpenAIEndpoint { get { return Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT"); } }
    static string AzureOpenAIKey { get { return Environment.GetEnvironmentVariable("AZURE_OPENAI_APIKEY"); } }
}

Tip

DevExpress AI-poweredExtensions for WinForms

The following code snippets (auto-collected from DevExpress Examples) contain references to the Default field.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-generate-skin-palettes-with-ai/CS/DevExpress.AI.WinForms.AIGeneratePalette.Demo/Program.cs#L25

csharp
// Register the chat client and the palette generation extension in the DevExpress AI container.
var defaultContainer = AIExtensionsContainerDesktop.Default;
defaultContainer.RegisterChatClient(chatClient);

devexpress-ai-chat-samples/CS/DevExpress.AI.Samples.WPFBlazor/App.xaml.cs#L30

csharp
);
var container = AIExtensionsContainerDesktop.Default;
container.RegisterChatClient(openAIClient.AsChatClient(deployment));

winforms-chat-for-net-framework/CS/DevExpress.AI.WinForms.HtmlChat.Demo/Program.cs#L27

csharp
IChatClient chatClient = azureOpenAIClient.GetChatClient("gpt-4o-mini").AsIChatClient();
var container = AIExtensionsContainerDesktop.Default;
container.RegisterChatClient(chatClient);

See Also

AIExtensionsContainerDesktop Class

AIExtensionsContainerDesktop Members

DevExpress.AIIntegration Namespace