# Streaming AI Responses with InlineAIPrompt

The ASP.NET MVC InlineAIPrompt component enables streaming responses, allowing users to view AI-generated content in real time as it's being created. This capability significantly improves the user experience by offering instant feedback and a more dynamic interaction.

Streaming proves especially beneficial in scenarios such as:

* Handling lengthy AI outputs that require several seconds to complete.
* Building inline editing tools where users anticipate immediate updates.
* Connecting with AI platforms that deliver responses in chunks.
* Boosting engagement in contextual AI support environments.

## Configuration

To enable streaming in the InlineAIPrompt component, follow these steps:

1. Enable the `IsStreaming` property of the InlineAIPrompt. This property controls whether the component displays the **Stop Generation** button and indicates that a response is being streamed.

   ```Razor HtmlHelper
       @(Html.Kendo().InlineAIPrompt()
           .Name("inlineAi")
           .IsStreaming(true)
           ...... //Additional configuration
       )
   ```

2. To initiate streaming in the ASP.NET MVC InlineAIPrompt component, you need to handle the `PromptRequest` event. This event is triggered when the user either clicks the **Send** button or presses Enter.

   ```Razor HtmlHelper
       @(Html.Kendo().InlineAIPrompt()
           .Name("inlineaiprompt")
           .Events(ev => ev.PromptRequest("onPromptRequest"))
           ... //Additional configuration
       )
   ```

   ```JS scripts
       <script>
           async function onPromptRequest(e) {
               const inlineAiPromptInstance = this;
               if (ev.prompt && ev.prompt.trim()) {
                   ......
               } else {
                   console.log("Prompt is empty, not sending request.");
               }
           }
       </script>
   ```

## See Also

* [Using the API of the InlineAIPrompt for ASP.NET MVC (Demo)](https://demos.telerik.com/aspnet-mvc/inlineaiprompt/api)
* [Client-Side API of the InlineAIPrompt](https://docs.telerik.com/kendo-ui/api/ui/inlineaiprompt)
* [Server-Side API of the InlineAIPrompt](https://www.telerik.com/aspnet-mvc/documentation/api/inlineaiprompt)
