Skip to main content
All docs
V24.2

AIExtensionsContainerLocal Class

A container that stores custom AI-powered extensions.

Namespace: DevExpress.AIIntegration

Assembly: DevExpress.AIIntegration.v24.2.dll

NuGet Package: DevExpress.AIIntegration

#Declaration

public sealed class AIExtensionsContainerLocal :
    AIExtensionsContainer

#Remarks

Similar to the default extensions container (AIExtensionsContainerDesktop.Default), the AIExtensionsContainerLocal class stores AI-powered extensions that you implement and register manually.

DevExpress UI controls do not automatically use AI-powered extensions included in the AIExtensionsContainerLocal container. This allows you to implement different behaviors for various parts/controls in your application.

The following code snippet handles the QueryIAIExtensionsContainer event to use the WilliamShakespeareStyleExtension only when requests are initiated by the richEditControl:

C#
using DevExpress.AIIntegration;

var localContainer = new AIExtensionsContainerLocal(AIExtensionsContainerDesktop.Default);
localContainer.Register<ChangeStyleRequest, WilliamShakespeareStyleExtension>();

AIExtensionsContainerDesktop.QueryIAIExtensionsContainer += (s, e) => {
    if (e.Source == richEditControl)
        e.Container = localContainer;
};

// ...
// A custom extension based on the DevExpress ChangeStyleExtension.
// The example overrides the GetSystemPrompt method to customize the pre-built prompt.
public class WilliamShakespeareStyleExtension : ChangeStyleExtension {
    public WilliamShakespeareStyleExtension(IServiceProvider serviceProvider) : base(serviceProvider) { }
    protected override string GetSystemPrompt(ChangeStyleRequest request) {
            return "Rewrite this text in the William Shakespeare style.";
    }
}

Run Demo: WinForms

#Inheritance

Object
DevExpress.AIIntegration.Internal.AIExtensionsStorage
AIExtensionsContainer
AIExtensionsContainerLocal

#Extension Methods

Show 38 items
See Also