# ASP.NET MVC InlineAIPrompt Overview

The Telerik UI InlineAIPrompt HtmlHelper for ASP.NET MVC is a server-side wrapper for the Kendo UI InlineAIPrompt widget.

The ASP.NET MVC InlineAIPrompt is a compact, popup-style component designed to enable seamless interaction with AI language models directly within your content.

It offers a streamlined interface for submitting prompts and receiving AI-generated responses, all without interrupting the user's workflow. This makes it ideal for use cases where contextual AI assistance is needed—providing intelligent support right where users are working.

* [Demo page for the InlineAIPrompt HtmlHelper](https://demos.telerik.com/aspnet-mvc/inline-aiprompt)

## Initializing the InlineAIPrompt

The following example demonstrates how to define the InlineAIPrompt.

```Razor HtmlHelper
    @(Html.Kendo().InlineAIPrompt()
        .Name("inline-aiprompt")
        .SystemPrompt("systemPrompt")
        .Popup(popup => popup.Width(400))
        .Placeholder("Ask a question")
    )
```

## Basic Configuration

The InlineAIPrompt provides options for configuring its commands, system prompt, and Speech-to-Text functionality. The following example demonstrates the basic configuration of the InlineAIPrompt.

```Razor HtmlHelper
@(Html.Kendo().Button()
    .Name("ai-btn")
    .Icon("sparkles")
    .Content("AI Assistance")
    .Events(e => e.Click("onClick"))
)

@(Html.Kendo().InlineAIPrompt()
    .Name("inlineAi")
    .Placeholder("Type your prompt here...")
    .Popup(p => p.Width(400))
    .SystemPrompt("systemPrompt")
    .SpeechToText(true)
    .Readonly(false)
    .Events(e => e.PromptResponse("onPromptRequest").PromptRequestCancel("onPromptRequestCancel"))
    .Commands(commands =>
    {
        commands.Add().Id("funnier").Icon("star").Text("Make the text funnier")
            .Prompt("funnierHandler");

        commands.Add().Id("explain").Icon("question").Text("Explain the text")
            .Prompt("explainHandler");
    })
)

@(Html.Kendo().TextArea()
    .Name("textarea")
    .HtmlAttributes(new { style = "height: 200px; width: 100%" })
    .Value("This is an example of post content")
)
```

```JS scripts
    <script>
        function onClick(e) {
            let inline = $("#inlineAi").data('kendoInlineAIPrompt');
            inline.open();
            $('.k-child-animation-container.k-popup').data('kendoPopup').position()
        }

        function systemPrompt(context, prompt) {
            var textarea = $("#textarea").data("kendoTextArea");
            return `${prompt}: ${textarea.value()}`;
        }

        function funnierHandler(e) {
            return `Make the following text funnier: `;
        }

        function explainHandler(e) {
            return `Explain the following text: `;
        }

        function onPromptRequest(ev) {
            console.log("promptRequest event is fired!")
        }

        function onPromptRequestCancel(ev) {
            console.log("promptRequestCancel event is fired!")
        }
    </script>
```

## Functionality and Features

* [Templates](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/conversational-ui/inline-aiprompt/templates)—The available templates allow you to control the rendering of the response.
* [Streaming](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/conversational-ui/inline-aiprompt/streaming)—The InlineAIPrompt supports streaming responses, allowing users to see AI-generated content as it is being produced.
* [Integration with Microsoft.Extensions.AI](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/helper-basics/microsoft-extensions-ai-integration)—The InlineAIPrompt supports using the <a href="https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.ai?view=net-9.0-pp" target="_blank">Microsoft.Extensions.AI library</a> to provide seamless integration with various AI models and boost your workflow when connecting the InlineAIPrompt with AI models.
* [Events](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/conversational-ui/inline-aiprompt/events)—The component emits a variety of events that allow you to implement custom functionality.
* [Accessibility](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/conversational-ui/inline-aiprompt/accessibility/overview)—The InlineAIPrompt is accessible for screen readers, supports WAI-ARIA attributes, and delivers [keyboard shortcuts](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/conversational-ui/aiprompt/accessibility/keyboard-navigation) for faster navigation.

## Next Steps

* [Getting Started with the InlineAIPrompt](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/conversational-ui/inline-aiprompt/getting-started)
* [Basic Usage of the InlineAIPrompt HtmlHelper for ASP.NET MVC (Demo)](https://demos.telerik.com/aspnet-mvc/inline-aiprompt)

## See Also

* [Using the API of the InlineAIPrompt for ASP.NET MVC (Demo)](https://demos.telerik.com/aspnet-mvc/inline-aiprompt/api)

* [Server-Side API of the InlineAIPrompt HtmlHelper](https://www.telerik.com/aspnet-mvc/documentation/api/inline-aiprompt)

* [Client-Side API of the InlineAIPrompt](https://docs.telerik.com/kendo-ui/api/ui/inline-aiprompt)
