Skip to main content
All docs
V25.1
  • AIExtensionsContainerDesktop.UnregisterChatClient(AIExtensionsContainer) Method

    Unregisters the currently registered AI chat client.

    Namespace: DevExpress.AIIntegration

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

    NuGet Package: DevExpress.AIIntegration.Desktop

    Declaration

    public static void UnregisterChatClient(
        this AIExtensionsContainer container
    )

    Parameters

    Name Type Description
    container AIExtensionsContainer

    The container that holds the registered AI client.

    Remarks

    The default container for AI services (AIExtensionsContainerDesktop.Default) can store only one registered AI client. An exception is raised if you attempt to register a second AI client.

    To switch between AI chat clients, call the UnregisterChatClient method to unregister the currently registered AI chat client and then register another AI chat client:

    using DevExpress.AIIntegration;
    using Microsoft.Extensions.AI;
    
    //...
    IChatClient asChatClientOpenAI;
    IChatClient asChatClientAzureOpenAI;
    
    //...
    //Initialize asChatClientOpenAI and asChatClientAzureOpenAI
    InitializeChatClientOpenAI();
    InitializeChatClientAzureOpenAI();
    
    // Register an OpenAI client.
    RegisterChatClient(asChatClientOpenAI);
    
    // Unregister the previously registered AI client.
    AIExtensionsContainerDesktop.Default.UnregisterChatClient();
    // Register an Azure OpenAI client.
    RegisterChatClient(asChatClientAzureOpenAI);
    
    See Also