New to Telerik UI for Blazor? Download Free 30-day trial
InlineAIPrompt - Streaming
- EXAMPLE
- VIEW SOURCE
- EDIT IN TELERIK REPL
- Change Theme
default
Enable Streaming
OnStreaming Speed (ms)
Document Draft
- Streaming.razor
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.