New to Telerik UI for BlazorStart a free 30-day trial

A component that enables you to compose AI interactions with a prompt input and a list of messages (outputs). It lets you execute predefined commands, switch between Prompt, Output, and Command views, and add custom views with ToolBar navigation.

Definition

Namespace:Telerik.Blazor.Components

Assembly:Telerik.Blazor.dll

Syntax:

C#
public class TelerikAIPrompt : AIPromptBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable

Inheritance: objectComponentBaseBaseComponentAIPromptBaseTelerikAIPrompt

Implements: IComponentIDisposableIHandleAfterRenderIHandleEvent

Inherited Members AIPromptBase.OnInitializedAsync()AIPromptBase.PromptContextAIPromptBase.SystemPromptAIPromptBase.OnPromptRequestStopAIPromptBase.PromptAIPromptBase.PromptChangedAIPromptBase.PromptPlaceholderBaseComponent.ShouldRender()BaseComponent.Dispose()BaseComponent.InitLocalizer()BaseComponent.ThrowIfParameterIsNull(object, string)BaseComponent.HaveOptionsChanged(IDictionary<string, object>, IDictionary<string, object>)BaseComponent.GetClassString(params string[])BaseComponent.InvokeAsync<T>(string, params object[])BaseComponent.InvokeAsync<T>(string, CancellationToken, params object[])BaseComponent.InvokeVoidAsync(string, params object[])BaseComponent.InvokeVoidAsyncWithoutAwait(string, params object[])BaseComponent.InvokeComponentMethodAsync<T>(string, params object[])BaseComponent.InvokeComponentMethodAsync<T>(string, CancellationToken, params object[])BaseComponent.InvokeVoidComponentMethodAsync(string, params object[])BaseComponent.InvokeComponentVoidMethodAsync(string, object)BaseComponent.InvokeDisposeAsync()BaseComponent.StateHasChanged()BaseComponent.RootComponentBaseComponent.ClassComponentBase.OnInitialized()ComponentBase.OnParametersSetAsync()ComponentBase.OnAfterRender(bool)ComponentBase.InvokeAsync(Action)ComponentBase.InvokeAsync(Func<Task>)ComponentBase.DispatchExceptionAsync(Exception)...

Constructors

C#
public TelerikAIPrompt()

Methods

C#
public void AddItem(IAIPromptToolBarItem item)
Parameters:itemIAIPromptToolBarItem

Add new Output item to the component.

C#
public void AddOutput(string output, string title, string subtitle, string prompt, string commandId, bool openOutputView = true)
Parameters:outputstringtitlestringsubtitlestringpromptstringcommandIdstringopenOutputViewbool
C#
public void AddView(AIPromptViewBase item)
Parameters:itemAIPromptViewBase
C#
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters:__builderRenderTreeBuilder

Overrides: ComponentBase.BuildRenderTree(RenderTreeBuilder)

C#
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters:firstRenderboolReturns:

Task

Overrides: BaseComponent.OnAfterRenderAsync(bool)

C#
protected override void OnParametersSet()

Overrides: ComponentBase.OnParametersSet()

Re-renders the component.

C#
public void Refresh()
C#
public void RemoveItem(IAIPromptToolBarItem item)
Parameters:itemIAIPromptToolBarItem
C#
public void RemoveView(AIPromptViewBase item)
Parameters:itemAIPromptViewBase
C#
protected void SetActiveView(AIPromptViewBase view, bool forceFocus = true)
Parameters:viewAIPromptViewBaseforceFocusbool
C#
public override Task SetParametersAsync(ParameterView parameters)
Parameters:parametersParameterViewReturns:

Task

Overrides: ComponentBase.SetParametersAsync(ParameterView)

Properties

Defines the settings for the AI prompt component. Children: AIPromptSpeechToTextButtonSettings.

C#
[Parameter]
public RenderFragment AIPromptSettings { get; set; }

Additional action buttons for the toolbar. These won't replace the buttons you got for the views. AIPromptToolBarButton, AIPromptToolBarSpacer and AIPromptToolBarTemplateItem items are supported. Children: AIPromptToolBarButton, AIPromptToolBarSpacer, AIPromptToolBarTemplateItem.

C#
[Parameter]
public RenderFragment AIPromptToolBar { get; set; }
C#
[Parameter]
public RenderFragment AIPromptViews { get; set; }

Defines the Commands of the component.

C#
[Parameter]
public List<AIPromptCommandDescriptor> Commands { get; set; }

Specifies whether to enable speech to text functionality.

C#
[Parameter]
public bool EnableSpeechToText { get; set; }

Defines the height of the component.

C#
[Parameter]
public string Height { get; set; }
C#
[Parameter]
public EventCallback<AIPromptCommandExecuteEventArgs> OnCommandExecute { get; set; }

Event callback that is triggered when an output action is clicked.

C#
[Parameter]
public EventCallback<AIPromptOutputActionClickEventArgs> OnOutputActionClick { get; set; }
C#
[Parameter]
public EventCallback<AIPromptPromptRequestEventArgs> OnPromptRequest { get; set; }

Defines the output actions for each output.

C#
[Parameter]
public List<AIPromptOutputActionDescriptor> OutputActions { get; set; }

Defines the Output Item Template of the component.

C#
[Parameter]
public RenderFragment<AIPromptOutputItemTemplateContext> OutputItemTemplate { get; set; }

Defines the Prompt Suggestion Item template of the component.

C#
[Parameter]
public RenderFragment<AIPromptSuggestionItemTemplateContext> PromptSuggestionItemTemplate { get; set; }

Defines the Prompt Suggestions of the component.

C#
[Parameter]
public List<string> PromptSuggestions { get; set; }

Defines the width of the component.

C#
[Parameter]
public string Width { get; set; }