New to KendoReact? Start a free 30-day trial
Streaming AI Responses
Streaming AI ResponsesPremium
The KendoReact AIPrompt supports streaming AI responses, which display content progressively as it's generated rather than waiting for the complete response.
Configuration
To implement streaming AI responses, you need to configure the following properties and event handlers:
- Enable streaming mode - Set the
streaming
property totrue
when content is being generated. - Handle generation requests - Use the
onPromptRequest
event to start streaming when users submit prompts. - Handle cancellation - Use the
onCancel
event to stop streaming when users click the Stop Generation button. - Manage outputs - Update the [
outputs
] array progressively as streamed content arrives.
Change Theme
Theme
Loading ...
When to Use Streaming
Streaming is ideal when you need to provide immediate feedback and maintain user engagement during AI response generation. Consider using streaming in the following scenarios:
- Working with long-form AI responses that take several seconds to generate, such as detailed explanations, code implementations, or comprehensive analysis.
- Creating chat-like interfaces where users expect real-time feedback and natural conversation flow.
- Integrating with AI services that support chunked responses, such as OpenAI's streaming API or similar services.
- Enhancing user engagement in conversational applications where waiting for complete responses would disrupt the interaction flow.