New to Telerik UI for Blazor? Download Free 30-day trial

Chat - AI Integration

  • EXAMPLE
  • VIEW SOURCE
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 Assistant
2/9/2026 12:00:59 AM
John Doe
Analyze my photo
  • corgi.jpg 34.67 KB
2/9/2026 12:00:59 AM
AI Assistant
The image shows a corgi surrounded by red hearts on a gray background. *
Now let me know if I can help you with your career aspirations.
Provide CV TemplateGenerate Cover Letter
  • Ai-integration.razor
  • AIPromptService.cs
  • Author.cs
  • Message.cs
Loading the demo source code...please wait.
Style in ThemeBuilder
  • Custom SASS variables
  • Atomic customizations
  • Sharing projects
Start Theming

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 Chat EnableAIChatClient 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.

Support & Learning Resources

An error has occurred. This application may no longer respond until reloaded.