| title | Getting Started |
|---|---|
| page_title | Getting Started - WinForms AIPrompt Control |
| description | AIPrompt |
| slug | aiprompt-getting-started |
| tags | aiprompt, getting-started, design, programmatically |
| published | true |
| position | 3 |
This article shows how you can start using RadAIPrompt. The following result will be achieved at the end of this tutorial:
note The design may vary according to the applied theme to the application.
To use RadAIPrompt when working with NuGet packages, install the Telerik.UI.for.WinForms.AllControls package. The [package target framework version may vary]({%slug winforms-available-nugets%}).
Read more about NuGet installation in the [Install using NuGet Packages]({%slug winforms/nuget%}) article.
tip With the 2025 Q1 release, the Telerik UI for WinForms has a new licensing mechanism. You can learn more about it [here]({%slug license-key%}).
When dragging and dropping a control from the Visual Studio (VS) Toolbox onto the Form Designer, VS automatically adds the necessary assemblies. However, if you're adding the control programmatically, you'll need to manually reference the following assemblies:
- Telerik.Licensing.Runtime
- Telerik.WinControls
- Telerik.WinControls.UI
- TelerikCommon
The Telerik UI for WinForms assemblies can be install by using one of the available [installation approaches]({%slug winforms/installation-deployment-and-distribution/installing-on-your-computer%}).
Follow the steps:
1. Go ahead and add a RadAIPrompt from the Visual Studio Toolbox.
2. Subscribe to the PromptRequest event: When the user press the Generate input button, the PromptRequest event will be triggered. In the event handler, you can connect to a AI model API to generate a response. The event arguments in the event handler provide information about the input text and if the request is generate for the first time or initiated to retry an already generated response.
You can create a new AIPromptOutputItem instance and fill it with returned response from the AI model. Then, you can populate the OutputItems collection of RadAIPrompt. This will create a new AIPromptOutputVisualItem in the Output view where you can interact with the response.
<snippet id='aiprompt-getting-started-promptrequest' />Private Sub RadAIPrompt1_PromptRequest(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.AIPrompt.PromptRequestEventArgs)
Dim responseAIPromptOutputItemModel As AIPromptOutputItem = New AIPromptOutputItem() With {
.Title = "Response from your AI model",
.InputText = e.InputText,
.ResponseText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
}
Me.radAIPrompt1.OutputItems.Add(responseAIPromptOutputItemModel)
End Sub
The AIPromptOutputItem element gives the end user ability to interact with the response of the AI model. The end user can copy the response, generate again the response or vote for it. When the user use one of these interaction options, the OutputItemAction event will be called. Thus allowing the developer to catch the moment of the user interaction and pass it to the AI model.
private void AIPrompt_OutputItemAction(object sender, OutputItemActionEventArgs e)
{
if (e.OutputItem.Rating != 0)
{
MyAIService.UpVoteResponse(e.OutputItem.Rating);
}
}Private Sub AIPrompt_OutputItemAction(ByVal sender As Object, ByVal e As OutputItemActionEventArgs)
If e.OutputItem.Rating <> 0 Then
MyAIService.UpVoteResponse(e.OutputItem.Rating)
End If
End Sub
- Telerik UI for WinForms AIPrompt Component
- Getting Started with Telerik UI for WinForms Components
- Telerik UI for WinForms Setup
- Telerik UI for WinForms Application Modernization
- Telerik UI for WinForms Visual Studio Templates
- Deploy Telerik UI for WinForms Applications
- Telerik UI for WinForms Virtual Classroom(Training Courses for Registered Users)
- Telerik UI for WinForms License Agreement)
- [AIPrompt Button]({%slug aiprompt-prompt-button%})
