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

Provides an AI chat client and prompt processing for the spreadsheet AI tools.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.RadSpreadsheet.dll

Syntax:

C#
[CLSCompliant(false)]
public class AIToolsProvider

Inheritance: objectAIToolsProvider

Constructors

Initializes a new instance of the AIToolsProvider class.

C#
public AIToolsProvider(IChatClient client, RadSpreadsheet spreadsheet)
Parameters:clientIChatClient

The AI chat client instance.

spreadsheetRadSpreadsheet

The RadSpreadsheet instance associated with this provider.

Properties

Agent

ChatClientAgent

Gets the AI chat client agent configured for this provider.

C#
public ChatClientAgent Agent { get; }

Gets or sets the maximum number of tokens that can be processed. Default is 128000.

C#
public int MaxTokenCount { get; set; }

Gets the RadSpreadsheet instance associated with this provider.

C#
public RadSpreadsheet Spreadsheet { get; }

Tools

List<AITool>

Gets the tools configured for this provider.

C#
public List<AITool> Tools { get; }

Methods

Sends a user prompt with spreadsheet context to the AI chat client and returns the response.

C#
public virtual Task<string> GetResponseAsync(string userPrompt, CancellationToken cancellationToken = default)
Parameters:userPromptstring

The user's prompt text.

cancellationTokenCancellationToken

A cancellation token to cancel the request.

Returns:

Task<string>

The AI-generated response text.

Initializes the AI tools collection and chat client agent.

C#
protected virtual void InitializeToolsAndAgent(IChatClient client)
Parameters:clientIChatClient

The AI chat client instance.