Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DevExpress AI-powered Extensions for Blazor

  • 2 minutes to read

DevExpress AI-powered Extensions for Blazor include the following extensions and UI components:

#Supported AI Services

DevExpress AI APIs allow you to register and use AI services supported by the Microsoft.Extensions.AI library:

Note

DevExpress AI-powered extensions follow the “bring your own key” principle. DevExpress does not offer a REST API and does not ship any built-in LLMs/SLMs. You need an active Azure/Open AI subscription to obtain the REST API endpoint, key, and model deployment name. These variables must be specified at application startup to register AI clients and enable DevExpress AI-powered Extensions in your application.

#Prerequisites

#Install NuGet Packages

#OpenAI Service

#Azure OpenAI Service

#Ollama

#Register an AI Service

Call the AddDevExpressAI(IServiceCollection, Action<AIWebSettings>) method at application startup to register an AI service and enable DevExpress AI-powered extensions in your application.

The following code snippet registers an Azure OpenAI service:

using Azure;
using Azure.AI.OpenAI;
using Microsoft.Extensions.AI;
...
string azureOpenAIEndpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT");
string azureOpenAIKey = Environment.GetEnvironmentVariable("AZURE_OPENAI_API_KEY");
string deploymentName = string.Empty;
...
IChatClient chatClient = new AzureOpenAIClient(
    new Uri(azureOpenAIEndpoint),
    new AzureKeyCredential(azureOpenAIKey)).AsChatClient(deploymentName);

builder.Services.AddDevExpressBlazor();
builder.Services.AddChatClient(config => config.Use(chatClient));
builder.Services.AddDevExpressAI();
See Also