# AI-powered Extensions for WPF | WPF Controls | DevExpress Documentation

## Supported AI Clients

- OpenAI
- Azure OpenAI
- Anthropic (Claude)
- Semantic Kernel
- Ollama (self-hosted models)
- Foundry Local (on-device AI models)
- ONNX Runtime (local ONNX models)

## Prerequisites

- [.NET 8+ SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) / .NET Framework v4.7.2
- **OpenAI**
    - An active Open AI subscription
    - OpenAI API key
    - [OpenAI .NET SDK (Version=”2.2.0”)](https://www.nuget.org/packages/OpenAI/2.2.0)
    - [Microsoft.Extensions.AI.OpenAI (Version=”9.7.1-preview.1.25365.4”)](https://www.nuget.org/packages/Microsoft.Extensions.AI.OpenAI/9.7.1-preview.1.25365.4)
- **Azure OpenAI**
    - An active Azure subscription
    - [Azure Open AI Service resource](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?source=recommendations&amp;pivots=web-portal)
    - [Azure OpenAI .NET SDK (Version=”2.2.0-beta.5”)](https://www.nuget.org/packages/Azure.AI.OpenAI/2.2.0-beta.5)
    - [Microsoft.Extensions.AI.OpenAI (Version=”9.7.1-preview.1.25365.4”)](https://www.nuget.org/packages/Microsoft.Extensions.AI.OpenAI/9.7.1-preview.1.25365.4)
- **Anthropic (Claude)**
    - An active [Anthropic](https://www.anthropic.com/) account
    - An Anthropic API key
    - [Anthropic .NET SDK](https://www.nuget.org/packages/Anthropic) (the official Claude SDK for C#; v10+ targets `Microsoft.Extensions.AI`)
- **Semantic Kernel**
    - [Microsoft.SemanticKernel](https://www.nuget.org/packages/Microsoft.SemanticKernel)
    - An active account/subscription to the AI service of your choice
    - [Microsoft.SemanticKernel.Connectors.*](https://www.nuget.org/packages?q=Microsoft.SemanticKernel.Connectors) NuGet package (a connector to the AI service of your choice)
- **Ollama**(self-hosted models)
    - [Download and install Ollama](https://ollama.com/download)
    - [Download and install an Ollama model](https://ollama.com/library)
    - [OllamaSharp](https://www.nuget.org/packages/OllamaSharp)
- **Foundry Local** (on-device AI models)

    - .NET 8+ SDK
    - `Microsoft.AI.Foundry.Local*` Nuget package:

        - **Windows**: `Microsoft.AI.Foundry.Local.WinML (Version="0.8.2.1")` (or later)
        - **Cross-Platform**: `Microsoft.AI.Foundry.Local (Version="0.8.2.1")` (or later)

          See the following setup instructions: [Project setup guide - Foundry Local SDK reference](https://learn.microsoft.com/en-us/azure/ai-foundry/foundry-local/reference/reference-sdk?view=foundry-classic&amp;tabs=xplatform&amp;pivots=programming-language-csharp#project-setup-guide).
    - [OpenAI .NET SDK (Version=”2.2.0”)](https://www.nuget.org/packages/OpenAI/2.2.0)
    - [Microsoft.Extensions.AI (Version=”9.7.1”)](https://www.nuget.org/packages/Microsoft.Extensions.AI/9.7.1)
    - [Microsoft.Extensions.AI.OpenAI (Version=”9.7.1-preview.1.25365.4”)](https://www.nuget.org/packages/Microsoft.Extensions.AI.OpenAI/9.7.1-preview.1.25365.4)
    - [Foundry Local Installation](https://github.com/microsoft/Foundry-Local) (optional; the SDK does not require the CLI to run models)
    - A local AI model (models download automatically when you use aliases such as `phi-4`)
- **ONNX Runtime**(local ONNX models)
    - .NET 8+ SDK
    - [Microsoft.ML.OnnxRuntimeGenAI](https://www.nuget.org/packages/Microsoft.ML.OnnxRuntimeGenAI)
    - A local ONNX model ([Hugging Face Models](https://huggingface.co/models?library=onnx) or [ONNX Model Zoo](https://github.com/onnx/models))
    - [Hugging Face CLI](https://huggingface.co/docs/huggingface_hub/main/en/guides/cli) (recommended for downloading models from Hugging Face)

`DevExpress.AIIntegration` assemblies reference the following versions of `Microsoft.Extensions.AI.*` NuGet packages:

| Package Name | v26.1 |
| --- | --- |
| `Microsoft.Extensions.AI` | 9.7.1 |
| `Microsoft.Extensions.AI.OpenAI` | 9.7.1-preview.1.25365.4 |

See the following breaking change advisory for more information: [DevExpress.AIIntegration references stable versions of Microsoft AI packages](https://supportcenter.devexpress.com/ticket/details/t1292705/devexpress-aiintegration-references-stable-versions-of-microsoft-ai-packages).

## Install DevExpress NuGet Packages

1. `DevExpress.AIIntegration.Wpf`
2. `DevExpress.Wpf`

## Register AI Clients

DevExpress AI-powered extensions operate within an [AIExtensionsContainerDesktop](/CoreLibraries/DevExpress.AIIntegration.AIExtensionsContainerDesktop) container. This container manages all registered AI clients so that DevExpress UI controls can automatically leverage AI services. You should register an AI client at application startup (*App.xml.cs*).

### Register OpenAI Client

The following code snippet registers an OpenAI client at application startup within the [AIExtensionsContainerDesktop](/CoreLibraries/DevExpress.AIIntegration.AIExtensionsContainerDesktop) container:

- C#
- VB.NET

<section id="tabpanel_87RxQMxtOO_tabid-csharp" role="tabpanel" data-tab="tabid-csharp">
<pre><code data-code-links="{&quot;/ (DevExpress.AIIntegration)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.AIIntegration&quot;,&quot;/ (DevExpress.Xpf.Core)(?:;|$)/&quot;:&quot;/WPF/DevExpress.Xpf.Core&quot;,&quot;/ (System)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system&quot;,&quot;/ (System.Windows)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.windows&quot;}" data-highlight-lines="[[17,19]]" class="lang-csharp">using DevExpress.AIIntegration;
using DevExpress.Xpf.Core;
using Microsoft.Extensions.AI;
using System;
using System.Windows;

namespace AIAssistantApp {
    public partial class App : Application {
        static App() {
            CompatibilitySettings.UseLightweightThemes = true;
        }

        protected override void OnStartup(StartupEventArgs e) {
            base.OnStartup(e);
            ApplicationThemeHelper.ApplicationThemeName = &quot;Office2019Colorful&quot;;

            // For example, Model = &quot;gpt-4o-mini&quot;
            IChatClient openAIChatClient = new OpenAI.OpenAIClient(OpenAIKey).GetChatClient(Model)
                .AsIChatClient();
            AIExtensionsContainerDesktop.Default.RegisterChatClient(openAIChatClient);
        }
    }
}
</code></pre></section>
<section id="tabpanel_87RxQMxtOO_tabid-vb" role="tabpanel" data-tab="tabid-vb" aria-hidden="true" hidden="hidden">
<pre><code data-code-links="{&quot;/ (DevExpress.AIIntegration)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.AIIntegration&quot;,&quot;/ (DevExpress.Xpf.Core)(?:;|$)/&quot;:&quot;/WPF/DevExpress.Xpf.Core&quot;,&quot;/ (System)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system&quot;,&quot;/ (System.Windows)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.windows&quot;}" class="lang-vb">Imports DevExpress.AIIntegration
Imports DevExpress.Xpf.Core
Imports Microsoft.Extensions.AI
Imports System
Imports System.Windows

Namespace AIAssistantApp
    Partial Public Class App
        Inherits Application

        Shared Sub New()
            CompatibilitySettings.UseLightweightThemes = True
        End Sub

        Protected Overrides Sub OnStartup(ByVal e As StartupEventArgs)
            MyBase.OnStartup(e)
            ApplicationThemeHelper.ApplicationThemeName = &quot;Office2019Colorful&quot;

            &#39; For example, Model = &quot;gpt-4o-mini&quot;
            Dim openAIChatClient As IChatClient = New OpenAI.OpenAIClient(OpenAIKey).GetChatClient(Model).AsIChatClient()
            AIExtensionsContainerDesktop.Default.RegisterChatClient(openAIChatClient)
        End Sub
    End Class
End Namespace
</code></pre></section>

### Register Azure OpenAI Client

The following code snippet registers an Azure OpenAI client at application startup within the [AIExtensionsContainerDesktop](/CoreLibraries/DevExpress.AIIntegration.AIExtensionsContainerDesktop) container:

- C#
- VB.NET

<section id="tabpanel_87RxQMxtOO-1_tabid-csharp" role="tabpanel" data-tab="tabid-csharp">
<pre><code data-code-links="{&quot;/ (DevExpress.AIIntegration)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.AIIntegration&quot;,&quot;/ (DevExpress.Xpf.Core)(?:;|$)/&quot;:&quot;/WPF/DevExpress.Xpf.Core&quot;,&quot;/ (System)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system&quot;,&quot;/ (System.Windows)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.windows&quot;}" data-highlight-lines="[[19,21]]" class="lang-csharp">using Azure.AI.OpenAI;
using DevExpress.AIIntegration;
using DevExpress.Xpf.Core;
using Microsoft.Extensions.AI;
using System;
using System.Windows;

namespace AIAssistantApp {
    public partial class App : Application {
        static App() {
            CompatibilitySettings.UseLightweightThemes = true;
        }

        protected override void OnStartup(StartupEventArgs e) {
            base.OnStartup(e);
            ApplicationThemeHelper.ApplicationThemeName = &quot;Office2019Colorful&quot;;

            // For example, ModelId = &quot;gpt-4o-mini&quot;
            IChatClient azureChatClient = new Azure.AI.OpenAI.AzureOpenAIClient(new Uri(AzureOpenAIEndpoint),
                new System.ClientModel.ApiKeyCredential(AzureOpenAIKey)).GetChatClient(ModelId).AsIChatClient();
            AIExtensionsContainerDesktop.Default.RegisterChatClient(azureChatClient);
        }
    }
}
</code></pre></section>
<section id="tabpanel_87RxQMxtOO-1_tabid-vb" role="tabpanel" data-tab="tabid-vb" aria-hidden="true" hidden="hidden">
<pre><code data-code-links="{&quot;/ (DevExpress.AIIntegration)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.AIIntegration&quot;,&quot;/ (DevExpress.Xpf.Core)(?:;|$)/&quot;:&quot;/WPF/DevExpress.Xpf.Core&quot;,&quot;/ (System)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system&quot;,&quot;/ (System.Windows)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.windows&quot;}" class="lang-vb">Imports Azure.AI.OpenAI
Imports DevExpress.AIIntegration
Imports DevExpress.Xpf.Core
Imports Microsoft.Extensions.AI
Imports System
Imports System.Windows

Imports System
Imports System.Windows
Imports Azure.AI.OpenAI

Namespace AIAssistantApp
    Partial Public Class App
        Inherits Application

        Shared Sub New()
            CompatibilitySettings.UseLightweightThemes = True
        End Sub

        Protected Overrides Sub OnStartup(e As StartupEventArgs)
            MyBase.OnStartup(e)
            ApplicationThemeHelper.ApplicationThemeName = &quot;Office2019Colorful&quot;

            &#39; For example, ModelId = &quot;gpt-4o-mini&quot;
            Dim azureChatClient As IChatClient = New AzureOpenAIClient(New Uri(AzureOpenAIEndpoint), 
                New System.ClientModel.ApiKeyCredential(AzureOpenAIKey)).GetChatClient(ModelId).AsIChatClient()
            AIExtensionsContainerDesktop.Default.RegisterChatClient(azureChatClient)
        End Sub
    End Class
End Namespace
</code></pre></section>

### Register Anthropic Client

Install the official [Anthropic .NET SDK](https://www.nuget.org/packages/Anthropic) NuGet package to register a Claude chat client. The `AsIChatClient` method returns a `Microsoft.Extensions.AI`-compatible `IChatClient`. Pass the model name to this method.

The `AnthropicClient` reads the API key from the `ANTHROPIC_API_KEY` environment variable, so no additional configuration is required when this variable is set.

The following code snippet registers an Anthropic (Claude) client at application startup within the [AIExtensionsContainerDesktop](/CoreLibraries/DevExpress.AIIntegration.AIExtensionsContainerDesktop) container:

- C#
- VB.NET

<section id="tabpanel_87RxQMxtOO-2_tabid-csharp" role="tabpanel" data-tab="tabid-csharp">
<pre><code data-code-links="{&quot;/ (DevExpress.AIIntegration)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.AIIntegration&quot;,&quot;/ (DevExpress.Xpf.Core)(?:;|$)/&quot;:&quot;/WPF/DevExpress.Xpf.Core&quot;,&quot;/ (System)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system&quot;,&quot;/ (System.Windows)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.windows&quot;}" data-highlight-lines="[[19,20]]" class="lang-csharp">using Anthropic;
using DevExpress.AIIntegration;
using DevExpress.Xpf.Core;
using System;
using System.Windows;

namespace AIAssistantApp {
    public partial class App : Application {
        static App() {
            CompatibilitySettings.UseLightweightThemes = true;
        }

        protected override void OnStartup(StartupEventArgs e) {
            base.OnStartup(e);
            ApplicationThemeHelper.ApplicationThemeName = &quot;Office2019Colorful&quot;;

            // The API key is read from the ANTHROPIC_API_KEY environment variable.
            // Pass the model name to AsIChatClient.
            IChatClient anthropicChatClient = new AnthropicClient().AsIChatClient(&quot;claude-haiku-4-5&quot;);
            AIExtensionsContainerDesktop.Default.RegisterChatClient(anthropicChatClient);
        }
    }
}
</code></pre></section>
<section id="tabpanel_87RxQMxtOO-2_tabid-vb" role="tabpanel" data-tab="tabid-vb" aria-hidden="true" hidden="hidden">
<pre><code data-code-links="{&quot;/ (DevExpress.AIIntegration)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.AIIntegration&quot;,&quot;/ (DevExpress.Xpf.Core)(?:;|$)/&quot;:&quot;/WPF/DevExpress.Xpf.Core&quot;,&quot;/ (System)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system&quot;,&quot;/ (System.Windows)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.windows&quot;}" class="lang-vb">Imports Anthropic
Imports DevExpress.AIIntegration
Imports DevExpress.Xpf.Core
Imports Microsoft.Extensions.AI
Imports System
Imports System.Windows

Namespace AIAssistantApp
    Partial Public Class App
        Inherits Application

        Shared Sub New()
            CompatibilitySettings.UseLightweightThemes = True
        End Sub

        Protected Overrides Sub OnStartup(ByVal e As StartupEventArgs)
            MyBase.OnStartup(e)
            ApplicationThemeHelper.ApplicationThemeName = &quot;Office2019Colorful&quot;

            &#39; The API key is read from the ANTHROPIC_API_KEY environment variable.
            &#39; Pass the model name to AsIChatClient.
            Dim anthropicChatClient As IChatClient = New AnthropicClient().AsIChatClient(&quot;claude-haiku-4-5&quot;)
            AIExtensionsContainerDesktop.Default.RegisterChatClient(anthropicChatClient)
        End Sub
    End Class
End Namespace
</code></pre></section>

#### Enable Reasoning (Extended Thinking)

To enable Claude’s extended thinking, configure chat client options and pass the `thinking` parameter through `AdditionalProperties`:

- C#
- VB.NET

<section id="tabpanel_87RxQMxtOO-3_tabid-csharp" role="tabpanel" data-tab="tabid-csharp">
<pre><code class="lang-csharp">using Anthropic;
using Microsoft.Extensions.AI;

IChatClient chatClient = new AnthropicClient()
    .AsIChatClient(&quot;claude-haiku-4-5&quot;)
    .AsBuilder()
    .ConfigureOptions(x =&gt; {
        x.Reasoning = new ReasoningOptions() {
            Effort = ReasoningEffort.Medium,
            Output = ReasoningOutput.Full
        };
        x.MaxOutputTokens = 4096;
        x.AdditionalProperties = new() {
            {
                &quot;thinking&quot;, new Dictionary&lt;string, object&gt; {
                    { &quot;type&quot;, &quot;enabled&quot; },
                    { &quot;budget_tokens&quot;, 2048 } // The minimum allowed budget is usually 1024 or 2048 tokens.
                }
            }
        };
    })
    .Build();
AIExtensionsContainerDesktop.Default.RegisterChatClient(chatClient);
</code></pre></section>
<section id="tabpanel_87RxQMxtOO-3_tabid-vb" role="tabpanel" data-tab="tabid-vb" aria-hidden="true" hidden="hidden">
<pre><code class="lang-vb">Imports Anthropic
Imports Microsoft.Extensions.AI

Dim chatClient As IChatClient = New AnthropicClient() _
    .AsIChatClient(&quot;claude-haiku-4-5&quot;) _
    .AsBuilder() _
    .ConfigureOptions(
        Sub(x)
            x.Reasoning = New ReasoningOptions() With {
                .Effort = ReasoningEffort.Medium,
                .Output = ReasoningOutput.Full
            }
            x.MaxOutputTokens = 4096
            x.AdditionalProperties = New AdditionalPropertiesDictionary() From {
                {
                    &quot;thinking&quot;, New Dictionary(Of String, Object) From {
                        {&quot;type&quot;, &quot;enabled&quot;},
                        {&quot;budget_tokens&quot;, 2048} &#39; The minimum allowed budget is usually 1024 or 2048 tokens.
                    }
                }
            }
        End Sub) _
    .Build()
AIExtensionsContainerDesktop.Default.RegisterChatClient(chatClient)
</code></pre></section>

Note

**Anthropic limitations**

Using Anthropic models with DevExpress AI-powered extensions has the following limitations:

- **No embedding model.** Anthropic does not offer an embeddings API ([source](https://platform.claude.com/docs/en/build-with-claude/embeddings)). Extensions and scenarios that rely on a vector store (for example, [Semantic Search](/WPF/405431/ai-powered-extensions/semantic-search)) require a separate, third-party embedding client (such as [Voyage AI](https://platform.claude.com/docs/en/build-with-claude/embeddings)).
- **No image generation.** Anthropic models cannot generate images. Extensions that produce images are not supported. Vision-based extensions that *analyze* existing images (such as [Generate Image Description](/WPF/405225/ai-powered-extensions/generate-image-description)) continue to work.

### Register Semantic Kernel

Install the connector package for the AI service. This example uses [Microsoft.SemanticKernel.Connectors.Google](https://www.nuget.org/packages/Microsoft.SemanticKernel.Connectors.Google/1.30.0-alpha).

- C#
- VB.NET

<section id="tabpanel_87RxQMxtOO-4_tabid-csharp" role="tabpanel" data-tab="tabid-csharp">
<pre><code data-code-links="{&quot;/ (DevExpress.AIIntegration)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.AIIntegration&quot;,&quot;/ (DevExpress.Xpf.Core)(?:;|$)/&quot;:&quot;/WPF/DevExpress.Xpf.Core&quot;,&quot;/ (System)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system&quot;,&quot;/ (System.Windows)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.windows&quot;}" class="lang-csharp">using Microsoft.Extensions.AI;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.ChatCompletion;
using Microsoft.SemanticKernel.Connectors.Google;
using DevExpress.AIIntegration;
using DevExpress.Xpf.Core;
using System;
using System.Windows;

namespace AIAssistantApp {
    public partial class App : Application {
        static App() {
            CompatibilitySettings.UseLightweightThemes = true;
        }
        protected override void OnStartup(StartupEventArgs e) {
            base.OnStartup(e);
            ApplicationThemeHelper.ApplicationThemeName = &quot;Office2019Colorful&quot;;

            var builder = Kernel.CreateBuilder().AddGoogleAIGeminiChatCompletion(&quot;YOUR_MODEL_ID&quot;, &quot;YOUR_API_KEY&quot;, GoogleAIVersion.V1_Beta);
            Kernel kernel = builder.Build();
            IChatClient googleChatClient = kernel.GetRequiredService&lt;IChatCompletionService&gt;().AsChatClient();
            AIExtensionsContainerDesktop.Default.RegisterChatClient(googleChatClient);
        }
    }
}
</code></pre></section>
<section id="tabpanel_87RxQMxtOO-4_tabid-vb" role="tabpanel" data-tab="tabid-vb" aria-hidden="true" hidden="hidden">
<pre><code data-code-links="{&quot;/ (DevExpress.AIIntegration)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.AIIntegration&quot;,&quot;/ (DevExpress.Xpf.Core)(?:;|$)/&quot;:&quot;/WPF/DevExpress.Xpf.Core&quot;,&quot;/ (System)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system&quot;,&quot;/ (System.Windows)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.windows&quot;}" class="lang-vb">Imports Microsoft.Extensions.AI
Imports Microsoft.SemanticKernel
Imports Microsoft.SemanticKernel.ChatCompletion
Imports Microsoft.SemanticKernel.Connectors.Google
Imports DevExpress.AIIntegration
Imports DevExpress.Xpf.Core
Imports System
Imports System.Windows

Namespace AIAssistantApp
    Partial Public Class App
        Inherits Application

        Shared Sub New()
            CompatibilitySettings.UseLightweightThemes = True
        End Sub
        Protected Overrides Sub OnStartup(ByVal e As StartupEventArgs)
            MyBase.OnStartup(e)
            ApplicationThemeHelper.ApplicationThemeName = &quot;Office2019Colorful&quot;

            Dim builder = Kernel.CreateBuilder().AddGoogleAIGeminiChatCompletion(&quot;YOUR_MODEL_ID&quot;, &quot;YOUR_API_KEY&quot;, GoogleAIVersion.V1_Beta)
            Dim kernel As Kernel = builder.Build()
            Dim googleChatClient As IChatClient = kernel.GetRequiredService(Of IChatCompletionService)().AsChatClient()
            AIExtensionsContainerDesktop.Default.RegisterChatClient(googleChatClient)
        End Sub
    End Class
End Namespace
</code></pre></section>

### Register Ollama Client

The following code snippet registers an Ollama client:

- C#
- VB.NET

<section id="tabpanel_87RxQMxtOO-5_tabid-csharp" role="tabpanel" data-tab="tabid-csharp">
<pre><code data-code-links="{&quot;/ (DevExpress.AIIntegration)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.AIIntegration&quot;,&quot;/ (DevExpress.Xpf.Core)(?:;|$)/&quot;:&quot;/WPF/DevExpress.Xpf.Core&quot;,&quot;/ (System)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system&quot;,&quot;/ (System.Windows)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.windows&quot;}" data-highlight-lines="[[18],[19]]" class="lang-csharp">using OllamaSharp;
using DevExpress.AIIntegration;
using DevExpress.Xpf.Core;
using Microsoft.Extensions.AI;
using System;
using System.Windows;

namespace AIAssistantApp {
    public partial class App : Application {
        static App() {
            CompatibilitySettings.UseLightweightThemes = true;
        }
        protected override void OnStartup(StartupEventArgs e) {
            base.OnStartup(e);
            ApplicationThemeHelper.ApplicationThemeName = &quot;Office2019Colorful&quot;;

            // Requires the &#39;Microsoft.Extensions.AI.Ollama&#39; NuGet package.
            IChatClient asChatClient = new OllamaApiClient(new Uri(&quot;http://localhost:11434/&quot;), &quot;MODEL_NAME&quot;);
            AIExtensionsContainerDesktop.Default.RegisterChatClient(asChatClient);
        }
    }
}
</code></pre></section>
<section id="tabpanel_87RxQMxtOO-5_tabid-vb" role="tabpanel" data-tab="tabid-vb" aria-hidden="true" hidden="hidden">
<pre><code data-code-links="{&quot;/ (DevExpress.AIIntegration)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.AIIntegration&quot;,&quot;/ (DevExpress.Xpf.Core)(?:;|$)/&quot;:&quot;/WPF/DevExpress.Xpf.Core&quot;,&quot;/ (System)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system&quot;,&quot;/ (System.Windows)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.windows&quot;}" class="lang-vb">Imports OllamaSharp
Imports DevExpress.AIIntegration
Imports DevExpress.Xpf.Core
Imports Microsoft.Extensions.AI
Imports System
Imports System.Windows

Namespace AIAssistantApp
    Partial Public Class App
        Inherits Application

        Shared Sub New()
            CompatibilitySettings.UseLightweightThemes = True
        End Sub
        Protected Overrides Sub OnStartup(ByVal e As StartupEventArgs)
            MyBase.OnStartup(e)
            ApplicationThemeHelper.ApplicationThemeName = &quot;Office2019Colorful&quot;

            &#39; Requires the &#39;Microsoft.Extensions.AI.Ollama&#39; NuGet package.
            Dim asChatClient As IChatClient = New OllamaApiClient(New Uri(&quot;http://localhost:11434/&quot;), &quot;MODEL_NAME&quot;)
            AIExtensionsContainerDesktop.Default.RegisterChatClient(asChatClient)
        End Sub
    End Class
End Namespace
</code></pre></section>

### Register Foundry Local

The following code snippets register a [Foundry Local](https://learn.microsoft.com/en-us/azure/ai-foundry/foundry-local/?view=foundry-classic) chat client. Foundry Local runs AI models directly on the local device. It does not require cloud services or API keys. The SDK downloads and manages models automatically and exposes an OpenAI-compatible interface.

Note

Users do not need to install the Foundry Local CLI. The SDK is self-contained and handles model downloads and execution independently.

- C#
- VB.NET

<section id="tabpanel_87RxQMxtOO-6_tabid-csharp" role="tabpanel" data-tab="tabid-csharp">
<pre><code data-code-links="{&quot;/ (DevExpress.AIIntegration)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.AIIntegration&quot;,&quot;/ (Microsoft.Extensions.Logging)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging&quot;,&quot;/ (System)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system&quot;,&quot;/ (System.Threading.Tasks)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.threading.tasks&quot;,&quot;/ (System.Windows.Forms)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.windows.forms&quot;}" class="lang-csharp">using DevExpress.AIIntegration;
using Microsoft.AI.Foundry.Local;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.Logging;
using OpenAI;
using System;
using System.ClientModel;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplication {
    internal static class Program {
        /// &lt;summary&gt;
        /// The main entry point for the application.
        /// &lt;/summary&gt;
        [STAThread]
        internal static void Main() {
            // Create a LoggerFactory and configure console logging.
            using var loggerFactory = LoggerFactory.Create(builder ={
                builder
                    // Set log level based on environment variable, fallback to Information
                    .SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Information)
                    .AddSimpleConsole(options ={ options.SingleLine = true; options.TimestampFormat = &quot;HH:mm:ss &quot;; });
            });

            // Specify the model name.
            string modelName = &quot;phi-4-mini&quot;;

            // Register a Foundry Local client.
            RegisterFoundryLocalClient(modelName, loggerFactory).GetAwaiter();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }

        async static Task RegisterFoundryLocalClient(string modelAlias, ILoggerFactory loggerFactory) {
            // Initialize the Foundry Local manager.
            var config = new Configuration {
                AppName = &quot;DevExpressAIApp&quot;,
                LogLevel = Microsoft.AI.Foundry.Local.LogLevel.Information,
                Web = new Configuration.WebService() {
                    Urls = &quot;http://127.0.0.1:52495&quot;
                }
            };

            // Create a named logger.
            var logger = loggerFactory.CreateLogger(&quot;FoundryLocal&quot;);

            await FoundryLocalManager.CreateAsync(config, logger, null);

            var manager = FoundryLocalManager.Instance;
            var catalog = await manager.GetCatalogAsync();

            // Get the model from the catalog by alias.
            var model = await catalog.GetModelAsync(modelAlias) ?? throw new Exception($&quot;Model {modelAlias} not found&quot;);

            // Check whether the model is cached and download it if required.
            if (!await model.IsCachedAsync()) {
                await model.DownloadAsync(progress ={
                    if (progress &gt;= 100f) Console.WriteLine();
                });
            }

            // Load the model.
            await model.LoadAsync();

            // Start the web service.
            await manager.StartWebServiceAsync();

            // OpenAIClient requires an ApiKeyCredential, but local Foundry server runs without credentials.
            ApiKeyCredential key = new ApiKeyCredential(&quot;key_not_required&quot;);

            // Create the OpenAI client that points to the Foundry Local web service.
            OpenAIClient client = new OpenAIClient(key, new OpenAIClientOptions {
                Endpoint = new Uri(config.Web.Urls + &quot;/v1&quot;),
            });

            // Get the chat client.
            IChatClient chatClient = client.GetChatClient(model.Id).AsIChatClient();
            AIExtensionsContainerDesktop.Default.RegisterChatClient(chatClient);

            // Cleanup on exit.
            Application.ApplicationExit += async (sender, e) ={
                try {
                    chatClient.Dispose();
                    await model.UnloadAsync();
                }
                catch (Exception unloadEx) {
                    logger.LogWarning(unloadEx, &quot;Error during model unload/cleanup.&quot;);
                }
            };
        }
    }
}
</code></pre></section>
<section id="tabpanel_87RxQMxtOO-6_tabid-vb" role="tabpanel" data-tab="tabid-vb" aria-hidden="true" hidden="hidden">
<pre><code data-code-links="{&quot;/ (DevExpress.AIIntegration)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.AIIntegration&quot;,&quot;/ (Microsoft.Extensions.Logging)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging&quot;,&quot;/ (System)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system&quot;,&quot;/ (System.Threading.Tasks)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.threading.tasks&quot;,&quot;/ (System.Windows.Forms)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.windows.forms&quot;}" class="lang-vb">Imports DevExpress.AIIntegration
Imports Microsoft.AI.Foundry.Local
Imports Microsoft.Extensions.AI
Imports Microsoft.Extensions.Logging
Imports OpenAI
Imports System
Imports System.ClientModel
Imports System.Threading.Tasks
Imports System.Windows.Forms

Namespace DXApplication
    Friend Module Program

        &#39;&#39;&#39; &lt;summary&gt;
        &#39;&#39;&#39; The main entry point for the application.
        &#39;&#39;&#39; &lt;/summary&gt;
        &lt;STAThread&gt;
        Sub Main()

            &#39; Create a LoggerFactory and configure console logging.
            Using loggerFactory = LoggerFactory.Create(
                Sub(builder)
                    builder _
                        .SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Information) _
                        .AddSimpleConsole(
                            Sub(options)
                                options.SingleLine = True
                                options.TimestampFormat = &quot;HH:mm:ss &quot;
                            End Sub)
                End Sub)

                &#39; Specify the model name.
                Dim modelName As String = &quot;phi-4-mini&quot;

                &#39; Register a Foundry Local client.
                RegisterFoundryLocalClient(modelName, loggerFactory).GetAwaiter()

                Application.EnableVisualStyles()
                Application.SetCompatibleTextRenderingDefault(False)
                Application.Run(New Form1())
            End Using
        End Sub

        Private Async Function RegisterFoundryLocalClient(
            modelAlias As String,
            loggerFactory As ILoggerFactory) As Task

            &#39; Initialize the Foundry Local manager.
            Dim config As New Configuration With {
                .AppName = &quot;DevExpressAIApp&quot;,
                .LogLevel = Microsoft.AI.Foundry.Local.LogLevel.Information,
                .Web = New Configuration.WebService With {
                    .Urls = &quot;http://127.0.0.1:52495&quot;
                }
            }

            &#39; Create a named logger.
            Dim logger = loggerFactory.CreateLogger(&quot;FoundryLocal&quot;)

            Await FoundryLocalManager.CreateAsync(config, logger, Nothing)

            Dim manager = FoundryLocalManager.Instance
            Dim catalog = Await manager.GetCatalogAsync()

            &#39; Get the model from the catalog by alias.
            Dim model = Await catalog.GetModelAsync(modelAlias)
            If model Is Nothing Then
                Throw New Exception($&quot;Model {modelAlias} not found&quot;)
            End If

            &#39; Check whether the model is cached and download it if required.
            If Not Await model.IsCachedAsync() Then
                Await model.DownloadAsync(
                    Sub(progress)
                        If progress &gt;= 100.0F Then
                            Console.WriteLine()
                        End If
                    End Sub)
            End If

            &#39; Load the model.
            Await model.LoadAsync()

            &#39; Start the web service.
            Await manager.StartWebServiceAsync()

            &#39; OpenAIClient requires an ApiKeyCredential, but local Foundry server runs without credentials.
            Dim key As New ApiKeyCredential(&quot;key_not_required&quot;)

            &#39; Create the OpenAI client that points to the Foundry Local web service.
            Dim client As New OpenAIClient(
                key,
                New OpenAIClientOptions With {
                    .Endpoint = New Uri(config.Web.Urls &amp; &quot;/v1&quot;)
                })

            &#39; Get the chat client.
            Dim chatClient As IChatClient =
                client.GetChatClient(model.Id).AsIChatClient()

            AIExtensionsContainerDesktop.Default.RegisterChatClient(chatClient)

            &#39; Cleanup on exit.
            AddHandler Application.ApplicationExit,
                Async Sub(sender, e)
                    Try
                        chatClient.Dispose()
                        Await model.UnloadAsync()
                    Catch unloadEx As Exception
                        logger.LogWarning(unloadEx, &quot;Error during model unload/cleanup.&quot;)
                    End Try
                End Sub

        End Function

    End Module
End Namespace
</code></pre></section>

See the following resources for additional information:

- [Foundry Local](https://www.foundrylocal.ai)
- [Foundry Local on GitHub](https://github.com/microsoft/Foundry-Local)
- [Microsoft.AI.Foundry.Local NuGet Package](https://www.nuget.org/packages/Microsoft.AI.Foundry.Local)
- [Foundry Local Documentation](https://learn.microsoft.com/azure/ai-foundry/foundry-local/?view=foundry-classic)

### Register ONNX Runtime

The following code snippets register an [ONNX Runtime GenAI](https://onnxruntime.ai/docs/genai/) chat client. ONNX Runtime runs optimized AI models directly on the local device. It does not require cloud services.

Note

ONNX models are not bundled with the SDK. You must download an ONNX model to the local machine before use. You can obtain ONNX models from [Hugging Face](https://huggingface.co/models?library=onnx) or [ONNX Model Zoo](https://github.com/onnx/models). You can also convert custom models with [ONNX converter tools](https://onnxruntime.ai/docs/tutorials/).

- C#
- VB.NET

<section id="tabpanel_87RxQMxtOO-7_tabid-csharp" role="tabpanel" data-tab="tabid-csharp">
<pre><code data-code-links="{&quot;/ (DevExpress.AIIntegration)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.AIIntegration&quot;}" class="lang-csharp">using DevExpress.AIIntegration;
using Microsoft.Extensions.AI;
using Microsoft.ML.OnnxRuntimeGenAI;

// Define the path to the ONNX model directory.
var modelPath = &quot;..\\..\\models\\cpu_and_mobile\\cpu-int4-rtn-block-32-acc-level-4\\&quot;;
// The path for Linux-based systems
// var modelPath = &quot;../../models/cpu_and_mobile/cpu-int4-rtn-block-32-acc-level-4/&quot;;

// Verify that the model directory exists.
if (!Directory.Exists(modelPath)) {
    MessageBox.Show(&quot;Model files not found. Ensure that the model files exist at the specified path.&quot;);
    return;
}

// Create the model configuration.
using var config = new Config(modelPath);

// Initialize the ONNX model.
using var model = new Model(config);

// Create an ONNX Runtime chat client.
using var onnxChatClient = new OnnxRuntimeGenAIChatClient(model);

// Configure chat client options.
using var chat = onnxChatClient.AsBuilder().ConfigureOptions(
    x =&gt; x.MaxOutputTokens = 4096
).Build();

// Register the chat client.
AIExtensionsContainerDesktop.Default.RegisterChatClient(chat);

// Handle application exit and unload the model.
Application.ApplicationExit += (sender, e) =&gt; {
    chat?.Dispose();
    onnxChatClient?.Dispose();
    model?.Dispose();
    config?.Dispose();
};
</code></pre></section>
<section id="tabpanel_87RxQMxtOO-7_tabid-vb" role="tabpanel" data-tab="tabid-vb" aria-hidden="true" hidden="hidden">
<pre><code data-code-links="{&quot;/ (DevExpress.AIIntegration)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.AIIntegration&quot;,&quot;/ (System.IO)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.io&quot;,&quot;/ (System.Windows.Forms)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.windows.forms&quot;}" class="lang-vb">Imports DevExpress.AIIntegration
Imports Microsoft.Extensions.AI
Imports Microsoft.ML.OnnxRuntimeGenAI
Imports System.IO
Imports System.Windows.Forms

Module Program

    Sub Main()

        &#39; Define the path to the ONNX model directory.
        Dim modelPath As String = &quot;..\..\models\cpu_and_mobile\cpu-int4-rtn-block-32-acc-level-4\&quot;
        &#39; The path for Linux-based systems
        &#39; Dim modelPath As String = &quot;../../models/cpu_and_mobile/cpu-int4-rtn-block-32-acc-level-4/&quot;

        &#39; Verify that the model directory exists.
        If Not Directory.Exists(modelPath) Then
            MessageBox.Show(&quot;Model files not found. Ensure that the model files exist at the specified path.&quot;)
            Return
        End If

        &#39; Create the model configuration.
        Using config As New Config(modelPath)

            &#39; Initialize the ONNX model.
            Using model As New Model(config)

                &#39; Create an ONNX Runtime chat client.
                Using onnxChatClient As New OnnxRuntimeGenAIChatClient(model)

                    &#39; Configure chat client options.
                    Dim chat =
                        onnxChatClient _
                            .AsBuilder() _
                            .ConfigureOptions(
                                Sub(x)
                                    x.MaxOutputTokens = 4096
                                End Sub) _
                            .Build()

                    &#39; Register the chat client.
                    AIExtensionsContainerDesktop.Default.RegisterChatClient(chat)

                    &#39; Handle application exit and unload the model.
                    AddHandler Application.ApplicationExit,
                        Sub(sender, e)
                            chat?.Dispose()
                            onnxChatClient?.Dispose()
                            model?.Dispose()
                            config?.Dispose()
                        End Sub

                    Application.Run()
                End Using
            End Using
        End Using

    End Sub

End Module
</code></pre></section>

Tip

- Set the model path to the directory containing ONNX model files (usually includes *genai\_config.json*, model weights, and tokenizer files).
- Configure `MaxOutputTokens` based on the model’s capabilities and your application’s requirements.
- ONNX models may have different configuration requirements. Refer to the model’s documentation on [Hugging Face](https://huggingface.co/models?library=onnx) or the model source.

#### Popular ONNX Models for AI-powered Extensions

- [microsoft/Phi-4-mini-instruct-onnx](https://huggingface.co/microsoft/Phi-4-mini-instruct-onnx) — Lightweight instruction-following model
- [microsoft/Phi-3.5-mini-instruct-onnx](https://huggingface.co/microsoft/Phi-3.5-mini-instruct-onnx) — Compact and efficient model
- Browse more models at [Hugging Face ONNX Models](https://huggingface.co/models?library=onnx)

See the following resources for additional information:

- [ONNX Runtime GenAI Documentation](https://onnxruntime.ai/docs/genai/)
- [Microsoft.ML.OnnxRuntimeGenAI NuGet Package](https://www.nuget.org/packages/Microsoft.ML.OnnxRuntimeGenAI)
- [Hugging Face CLI Documentation](https://huggingface.co/docs/huggingface_hub/main/en/guides/cli)

## AI-powered Extensions

### AI Assistant (Text Transform)

AI Assistant extensions allow you to enhance the way your users interact with and manage text content with AI-powered precision. These extensions leverage advanced natural language processing (NLP) technologies to give users automated, intelligent text manipulation capabilities within your WPF applications.

![AI Assistant - WPF Text Editor, DevExpress](/WPF/images/whats-new/24-2/24-2-wpf-memoedit-ai-assistant.png)

[Run Demo: AI Assistant](dxdemo://Wpf/AI/MainDemo/TextEditModule)

AI-powered options include:

- Change Style\*
- Change Tone\*
- Expand\*
- Explain
- Proofread
- Shorten
- Summarize
- Translate
- Ask AI Assistant (allows users to interact with an AI-powered assistant directly within your application)

Applies to:

- [Text Editor](/WPF/DevExpress.Xpf.Editors.TextEdit)
- [Rich Text Editor](/WPF/8651/controls-and-libraries/rich-text-editor)
- [Spreadsheet](/WPF/16118/controls-and-libraries/spreadsheet)
- [PDF Viewer](/WPF/16420/controls-and-libraries/pdf-viewer)

Note

The WPF Spreadsheet control does not support Change Style, Change Tone, and Expand extensions.

See the following help topic for additional information on how to activate and use AI Assistant extensions: [AI Assistant Extensions](/WPF/405224/ai-powered-extensions/ai-assistant).

### Explain Formula

The AI-powered “Explain Formula” extension generates a detailed explanation of the formula used in a worksheet cell in the DevExpress [Spreadsheet](/WPF/16118/controls-and-libraries/spreadsheet) control.

![Explain Formula - WPF Spreadsheet, DevExpress](/WPF/images/ai-explain-formula.png)

[Run Demo: Explain Formula](dxdemo://Wpf/AI/MainDemo/SpreadsheetModule)

See the following help topic for additional information: [Explain Formula](/WPF/405226/ai-powered-extensions/explain-formula).

### Generate Image Description

The AI-powered “Generate Image Description” extension generates the description for the image in DevExpress WPF [Spreadsheet](/WPF/16118/controls-and-libraries/spreadsheet) and [Rich Text Edit](/WPF/8651/controls-and-libraries/rich-text-editor) controls.

Play the following animation to see how the AI-powered “Generate Image Description” extension in a WPF Rich Text Editor generates Alt text for an image:

![Generate Image Description - WPF Rich Text Editor, DevExpress](/WPF/images/ai-describe-picture-wpf-richtexteditor.gif)

[Run Demo: Generate Image Description](dxdemo://Wpf/AI/MainDemo/RichEditModule)

Refer to the following help topic for additional information: [Generate Image Description](/WPF/405225/ai-powered-extensions/generate-image-description).

### Prompt to Expression

The AI-powered **Prompt to Expression** extension converts natural language into valid filter and column expressions for data-aware WPF controls. Users describe the desired behavior using their natural language instead of writing complex expressions:

- Sample Filter Expression

    - *Display delayed shipments*

- Sample Column Expression

    - *Display total cost*

The system sends the prompt to the configured AI service that generates a valid expression for the control. The [Expression Editor](/WPF/7554/common-concepts/expressions/expression-editor) or [Filter Editor](/WPF/7788/controls-and-libraries/data-grid/filtering-and-searching/filter-editor) displays and validates the result immediately.

[Run Demo: Prompt to Expression](dxdemo://Wpf/AI/MainDemo/ExpressionEditorAIModule)

Refer to the following help topic for additional information: [Prompt to Expression](/WPF/405834/ai-prompt-to-expression).

### Smart Autocomplete

The AI-powered “Smart Autocomplete” feature intelligently predicts and suggests words or phrases based on the user’s current input. As you type, the AI model analyzes the context of the text and makes relevant suggestions in real time.

![Smart Autocomplete - WPF Text Editor, DevExpress](/WPF/images/ai-smart-autocomplete-wpf-textedit.gif)

[Run Demo: Smart Autocomplete](dxdemo://Wpf/AI/MainDemo/SmartAutoCompleteModule)

Applies to:

[Text Editor](/WPF/DevExpress.Xpf.Editors.TextEdit)

See the following help topic for additional information: [Smart Autocomplete](/WPF/405227/ai-powered-extensions/smart-autocomplete).

### Smart Paste

“SmartPaste” is an AI-powered feature that transforms the traditional copy-and-paste process into a smarter, more efficient tool. Designed to improve productivity, SmartPaste analyzes the content you copy and intelligently assigns the right values to the appropriate fields or row cells in the DevExpress WPF Data Grid, TreeList, and LayoutControl-driven forms.

Play the following animation to see how SmartPaste works:

![Smart Paste - WPF Data Grid and Layout Control, DevExpress](/WPF/images/wpf-smart-paste-grid-layoutcontrol.gif)

[Run Demo: Smart Paste - Data Grid](dxdemo://Wpf/AI/MainDemo/SmartPasteModule)

Applies to:

- [Data Grid](/WPF/6084/controls-and-libraries/data-grid) (supported views: [TableView](/WPF/DevExpress.Xpf.Grid.TableView), [CardView](/WPF/DevExpress.Xpf.Grid.CardView), [TreeListView](/WPF/DevExpress.Xpf.Grid.TreeListView))
- [Layout Control](/WPF/8147/controls-and-libraries/layout-management/tile-and-layout/layout-and-data-layout-controls/layout-control)
- [TreeList](/WPF/9759/controls-and-libraries/tree-list)

See the following help topic for additional information: [Smart Paste](/WPF/405369/ai-powered-extensions/smart-paste).

### Smart Search

Smart Search works alongside traditional search algorithms to offer a more powerful and user-friendly search experience. It offers results that are more aligned with what the user is seeking, even if the input contains spelling errors.

![AI-powered Smart Search](/WPF/images/ai-powered-smart-search.gif)

[Run Demo: Smart Search - WPF Ribbon](dxdemo://Wpf/DXAI/MainDemo/SmartSearchModule)

Applies to:

- [Themed Window with integrated Ribbon Control](/WPF/DevExpress.Xpf.Core.ThemedWindow#integrate-the-ribbon--tab-control)
- [Accordion Control](/WPF/118347/controls-and-libraries/navigation-controls/accordion-control)

See the following help topic for additional information: [Smart Search](/WPF/405385/ai-powered-extensions/smart-search).

### Semantic Search

Semantic search enables users to locate relevant data quickly and accurately within large datasets. Unlike standard keyword-based search, semantic search leverages Natural Language Processing (NLP) to analyze search queries beyond exact keyword matching.

Semantic search uses an embedding generator to convert text into numerical vector representations. Vectors are stored in a vector database. When a user enters a search query, the search engine computes similarity scores between the query vector and stored data vectors to return the most relevant results.

![Semantic Search - WPF Grid Control, DevExpress](/WPF/images/wpf-grid-semantic-search.gif)

[Run Demo: Semantic Search - Grid Control](dxdemo://Wpf/DXAI/MainDemo/SemanticSearchModule)

Applies to: [Data Grid](/WPF/DevExpress.Xpf.Grid.GridControl)

See the following help topic for additional information: [Semantic Search](/WPF/405431/ai-powered-extensions/semantic-search).

### Custom Extensions

You can create custom extensions based on DevExpress AI-powered extensions. See the following help topic for additional information and examples: [Create Custom AI-powered Extensions](/WPF/405337/ai-powered-extensions/custom-ai-powered-extensions).

![Custom AI-powered Extension - WPF Text Editor, DevExpress](/WPF/images/create-custom-ai-powered-extension-textedit.png)

[Run Demo](dxdemo://Wpf/AI/MainDemo/CodeExamplesModule?CreateCustomExtension)

### Security Considerations (Indirect Prompt Injection)

DevExpress text-based AI-powered extensions and the [document-based Ask AI extension](/OfficeFileAPI/405645/ai-powered-extensions#ask-contextual-questions-about-document-content) process user-provided content (documents, messages, or clipboard data) and pass this content to an LLM for analysis. This workflow introduces a class of attacks (**indirect prompt injection**) where malicious instructions are embedded in valid content. These instructions may attempt to override system behavior, extract sensitive information, or manipulate the model’s output.

DevExpress AI-powered extensions include automatic prompt-injection protection. Protection is enabled by default for all text and document-based AI-powered extensions. The system adds protective instructions to AI requests. The LLM interprets these instructions and determines the final response.

Refer to the following help topic for additional information: [Prompt Injection Protection in AI-powered Extensions](/GeneralInformation/405921/security/prompt-injection-protection-in-ai-extensions).

## AI Chat Control

Note

The DevExpress AI Chat Control (`AIChatControl`) can only be used in WPF applications that target the .NET 8+ framework.

The AI Chat Control (`AIChatControl`) allows you to incorporate an interactive, Copilot-inspired chat-based UI within your WPF application. The DevExpress AI Chat Control can only be used in WPF applications that target the .NET 8+ framework.

![WPF AI Chat Control, DevExpress](/WPF/images/aichatcontrol.png)

Features include:

- Seamless Integration with AI Services
- Markdown Message Rendering
- Copy and Regenerate Responses
- Manual Handling of Chat Messages
- Create an Assistant That Chats Using Your Own Data
- Save and Load Chat History
- Streaming
- DevExpress Light and Dark Themes

See the following help topic for additional information: [AI Chat Control](/WPF/405434/ai-powered-extensions/ai-chat-control).

## See Also

- [Customize DevExpress AI-powered Extensions](/CoreLibraries/405204/ai-powered-extensions#customize-devexpress-ai-powered-extensions)
- [Error Logging and Handling](/CoreLibraries/405204/ai-powered-extensions#error-logging-and-handling)
- [Track Token Usage](/CoreLibraries/405204/ai-powered-extensions#track-token-usage)