This is a development environment

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

InlineAIPrompt - Streaming

Configurator

Enable Streaming

On

Streaming Speed (ms)

Document Draft

  • Streaming.razor
Loading the demo source code...please wait.
Style in ThemeBuilder
  • Custom SASS variables
  • Atomic customizations
  • Sharing projects
Start Theming

Description

The Telerik UI for Blazor InlineAIPrompt supports streaming responses, allowing the AI-generated output to appear incrementally as it arrives — character by character or chunk by chunk — rather than waiting for the full response before rendering.

To implement streaming, call AppendOutput(chunk) on the component reference each time a new piece of data arrives from your AI service. This progressively builds up the output visible to the user in real time. Handle the OnPromptRequestStop event to interrupt the stream when the user clicks the Stop Generation button.

Note: This demo simulates a streaming response using a timer that reveals characters one at a time. When implementing actual AI model streaming logic, replace the timer with your real AI service streaming calls. Update the component output as new data arrives using InlinePromptRef.AppendOutput(chunk), and cancel the ongoing request inside OnPromptRequestStop.

This Blazor InlineAIPrompt Streaming 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.