New to Telerik UI for Blazor? Download Free 30-day trial
Chat - AI Integration
- EXAMPLE
- VIEW SOURCE
- Change Theme
default
Configurator
Chat Streaming
By accessing and using the Telerik AI service integration on the Progress website, you acknowledge and agree to be bound by the following Terms of Use.
- Ai-integration.razor
- AIPromptService.cs
- Author.cs
- Message.cs
Loading the demo source code...please wait.
Description
This Telerik UI for Blazor Chat demo shows a seamless integration with an IChatClient AI service. It enables users to participate in a person-to-AI conversation.
The ChatEnableAIChatClient parameter instructs the component to resolve the registered IChatClient service in the app middleware and call it automatically on each user message. This setup spares the need for dependency injection and manual AI service calls in the OnSendMessage Chat event. Use the OnAIResponse event in ChatAIClientSettings to handle AI chat responses in a similar way to the OnSendMessage event that handles the user messages. You can also provide a custom system prompt and control how much message history is sent to the AI model for context.Note: The responses marked with an asterisk (*) are not AI generated.
This Blazor Chat AI Integration example is part of a unique collection of hundreds of Blazor demos, with which you can see all Telerik UI for Blazor components and their features in action. View the source code of the demos from the library or directly adapt, and edit them and their theme appearance in Telerik REPL for Blazor or ThemeBuilder.