Overview

DevExpress AI Chat for Blazor is an AI-enabled chat component that allows users to interact with multiple AI services. Our Blazor Chat component can be integrated with the following AI services:

  • OpenAI
  • Azure OpenAI
  • Ollama

To add the DxAIChat component to your application, register the desired AI service in your application. Select the approach that best fits your needs:

Use the following properties to customize the chat appearance:

  • ShowHeader: Displays a customizable chat header and a Clear Chat button.
  • UseStreaming: Allows the AI client to send parts of a response once they become available. The AI Chat component will update the display message accordingly for a more responsive chat experience.
  • AllowResizeInput: Allows users to resize the Blazor AI Chat input box. If this property is set to false, the input box automatically resizes itself as a user types.

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.

 Customize Message Appearance

Hello, AI!
Hey there, human! What's on your mind? 😊

The DevExpress Blazor AI Chat component allows you to modify the appearance of message bubbles. Use the MessageTemplate property to display any UI render fragment within a chat message. This template changes how the message bubble is rendered, including paddings and inner content alignment.

The BlazorChatMessage template context parameter includes details about the message being processed.

In this demo, the Initialized event handler calls the LoadMessages method to load message history during chat initialization.

 Manual Message Processing

Our Blazor Chat component (DxAIChat) raises the MessageSent event when a user sends a message to the chat. Handle the event to process this action as needed. You can use the Content event argument to access user input and call the SendMessage method to send another message to the chat.

In this demo, users can attach files to messages (the DxAIChat.FileUploadEnabled option is active). To access attached files in a MessageSent event handler, use its Files argument property.

 Customize Empty Message Area

AI Assistant is ready to answer your questions.

Define the EmptyMessageAreaTemplate to customize content displayed in the empty message area.

 Rich Formatted Response

Hello, AI!

Hey there, human! What's on your mind? 😊

AI services use plain text as the default response format. To display rich formatted responses within our Blazor Chat component (DxAIChat), set the ResponseContentFormat property to Markdown and use a markdown processor to convert response content to HTML code.

In this demo, the MessageContentTemplate property is used to render HTML code for message bubble content.

 Prompt Suggestions

How can I help you today?

DevExpress Blazor AI Chat supports prompt suggestions – hints that guide users to possible actions. The component displays prompt suggestions (hint bubbles) when the chat area is empty.

Follow the steps below to enable and configure prompt suggestions:

  1. Populate the component's PromptSuggestions property with DxAIChatPromptSuggestion objects (hint bubbles).
  2. Specify bubble content using Title and Text properties.
  3. Use the PromptMessage property to specify the text to be displayed in the input field after a user clicks the corresponding suggestion.

In this demo, the Initialized event handler supplies prompt suggestion content during chat initialization.

 File Attachments

Eiffel-Tower.jpg
Eiffel-Tower.jpg
Analyze the image file and summarize its content.
The image features the Eiffel Tower, a renowned landmark located in Paris, France. The tower is shown from a low angle, emphasizing its height and intricate iron lattice structure. The sky is lit with dramatic clouds and warm hues of sunset, creating a visually striking backdrop for the iconic monument. The overall scene conveys a sense of grandeur and beauty, highlighting the Eiffel Tower as a symbol of romance and architectural achievement.

DevExpress Blazor AI Chat allows users to attach files to messages. Set the DxAIChat.FileUploadEnabled property to true to activate file upload functionality. You can use a nested DxAIChatFileUploadSettings component to validate file size/extension and limit the number of files. This demo uses the drop-down menu to specify allowed file types.

In this demo, the Initialized event handler calls the LoadMessages method to pre-populate the chat with messages and file attachments. File attachments are specified by AIChatUploadFileInfo objects.

 Tool Call Visualization

AI Assistant
Click a tile below to call a function

AI Tool Calling allows Large Language Models (LLMs) to interact with your database files, APIs, and application logic. Instead of guessing an answer, the AI model selects the appropriate function from your code, and generates parameters needed to execute it.

Use the IncludeFunctionCallInfo property to automatically append AI tool execution details to the chat response. This feature allows you to debug and monitor how the LLM interacts with your system in real-time:

  • Optimize AI tool definitions: Refine metadata to make your tools easier for the LLM to understand.
  • Audit security: Identify when AI attempts to access sensitive or restricted data.
  • Build trust: Demonstrate to users that the response is based on actual data processing, not a hallucination.

 Resources

The DevExpress Blazor AI Chat component allows users to attach additional context to chat messages. Context can include binary files (images, audio, PDFs, documents) and non-file artifacts such as database schemas, structured records, or logs. You can also supply external content retrieved from a Model Context Protocol (MCP) server as a resource. Resources help the AI model generate more accurate answers and reduce hallucinations.

Use the Resources collection to manage chat context programmatically.

 AI Tools Integration

AI Assistant
Click a tile below to call a function
 
Drag a column header here to group by that column
Order IDCustomer NameCountryOrder DateProduct NameQuantityTotal ($)Status
1AliceUK5/30/2026Monitor3$571.60Delivered
2BobNetherlands6/5/2026USB Hub3$75.48On Hold
3CharlieUSA6/16/2026USB Hub1$23.87Processing
4DianaGermany5/22/2026Docking Station6$790.20Delivered
5EvanAustralia5/27/2026Docking Station3$386.20Shipped
6FionaSpain6/12/2026Graphic Tablet6$1,208.45Processing
7GeorgeFrance5/28/2026Keyboard1$48.18Cancelled
8HelenJapan6/8/2026USB Hub4$98.32On Hold
9IvanNetherlands6/19/2026Docking Station6$751.11Pending
10JuliaItaly6/4/2026Graphic Tablet3$606.53Pending
11KarlItaly6/9/2026Docking Station5$691.79On Hold
12LauraUSA6/5/2026Mouse3$65.47Processing
13MartinCanada5/29/2026USB Hub5$136.38Processing
14NinaGermany6/1/2026Mouse6$130.25Shipped
15OscarItaly6/15/2026Headset6$522.09Pending
16AliceSpain5/28/2026USB Hub6$144.62Processing
17BobFrance6/12/2026External SSD7$1,012.34Shipped
18CharlieNetherlands6/3/2026Keyboard7$314.59Cancelled
19DianaAustralia5/29/2026Webcam7$489.71Processing
20EvanUSA6/10/2026Laptop1$975.10Delivered
Data grid with 20 rows and 8 columns
0 rows are selected

The DevExpress AI Chat component can transform natural language input into application logic. This feature relies on AI Tools — specifically annotated methods that define their purpose, input parameters, and the target object against which they operate. Users can trigger UI updates or business workflows by entering requests in the chat.

This demo features the DevExpress AI tool calling layer that significantly extends Microsoft.Extensions.AI capabilities:

  • Context-aware targets: Tools can operate on specific Blazor components, data services, and business objects. The API automatically resolves the correct target instance at runtime.
  • Dynamic availability: Tools can be programmatically enabled, disabled, or removed based on current application state or user workflow.
  • Visual feedback: The AI Chat component includes a built-in UI that visualizes tool selection and execution process.

 AI Tool Approval

AI Assistant

DevExpress Blazor AI Chat can access individual AIContent items generated by the AI service. You can inspect streamed content, render custom UI for specific content types, send structured follow-up messages, and hide/display messages in chat history.

This demo adds an approval step for AI-driven actions before a potentially damaging operation is executed. When the model requests a tool call, the app reads message contents and locates tool approval requests in messages received from the AI provider. The AI Chat component then renders these requests as approval cards directly in the conversation.

After a user reviews all requests in the batch, the demo sends structured responses back to the model. The requested operation runs only after approval. The BlazorChatMessage.Visible property specifies whether individual messages remain visible in chat history.

 Reasoning Visualization

AI Assistant

DevExpress Blazor AI Chat can inspect individual AIContent items received from the model and render a custom UI for specific content types in chat history.

When you use reasoning models, message contents can include TextReasoningContent items together with final response text. This demo uses the MessageContentTemplate to detect reasoning content and render model thoughts directly in the chat.

The demo displays reasoning steps in an expandable panel and renders the final answer in a separate message area.

 Workflow as Agent

AI Assistant
🎭
Shakespearean Poet
The AI Assistant uses a few keywords to craft a poem, then rewrites it in the grand style of William Shakespeare. Choose a keyword combination below or enter 2 or 3 custom keywords.

This demo wraps a multi-step agent workflow into a single IChatResponseProvider instance. The DevExpress Blazor AI Chat component uses that object as a standard chat client.

To see the workflow in action, select a predefined keyword combination or enter custom keywords. The pipeline generates a short lyrical poem, then rewrites it in the style of William Shakespeare. A separate AI agent handles each workflow step.

 Workflow Response Streaming

AI Assistant
🎭
Workflow Response Streaming
This demo implements the same Shakespearean Poet pipeline and uses a custom workflow provider implementation (WorkflowResponseProvider). This provider streams events in real time. Enter 2 or 3 keywords to get started.

This demo executes a two-step Shakespearean Poet pipeline and uses a custom response provider implementation (WorkflowResponseProvider). This provider delivers intermediate workflow events in real time. As the pipeline progresses, agents at each workflow step produce their output, and the DevExpress Blazor AI Chat component displays results immediately.

 Workflow with Execution Steps

AI Assistant
🔄
Workflow with Execution Steps
Enter any text and start a two-step transformation workflow: UppercaseReverse. Our custom response provider (WorkflowResponseProvider) streams operation progress to the chat control in real time.

You can use the code from this demo as a starting point when building a custom executor pipeline. The demo implements a two-step deterministic workflow. The implementation uses code executors that do not make AI model calls. The workflow first converts input text to uppercase, then reverses the operation. Our custom response provider implementation (WorkflowResponseProvider) streams each transformation to the chat control in real time.

 AG-UI Integration

AI Assistant
🌤️
AG-UI Weather Agent
Ask about the weather in any city. Pick a suggestion below or enter your own prompt. The chat control queries a self-hosted Weather Agent. AG-UI protocol is used for communication.

This demo integrates the DevExpress Blazor AI Chat component with an external agent server through the AG-UI protocol.

Ask for current weather in any city. The DevExpress Blazor AI Chat component communicates with a self-hosted Weather Agent to obtain data. The component then renders the response using a custom message template.