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

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

Definition

Namespace:Telerik.Windows.Controls.Spreadsheet.AI

Assembly:Telerik.Windows.Controls.Spreadsheet.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 chat client used to create and run the AI agent.

spreadsheetRadSpreadsheet

The spreadsheet control that provides the workbook context.

Properties

Agent

ChatClientAgent

Gets or sets the AI agent used to process chat messages and tool calls.

C#
public ChatClientAgent Agent { get; set; }

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; }

Gets the registry of AI tools available to the agent.

C#
public List<AITool> ToolsRegistry { 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 spreadsheet context, AI tools registry, and agent instance.

C#
protected virtual void InitializeAgentAndTools(IChatClient client, RadSpreadsheet spreadsheet)
Parameters:clientIChatClient

The chat client used to create and run the AI agent.

spreadsheetRadSpreadsheet

The spreadsheet control that provides the workbook context.