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

Base class for summary providers using AI chat clients.

Definition

Namespace:Telerik.WinControls.UI.AIProviders

Assembly:Telerik.WinControls.PdfViewer.dll

Syntax:

C#
[CLSCompliant(false)]
public abstract class BaseSummaryProvider : ISummaryProvider

Inheritance: objectBaseSummaryProvider

Derived Classes: AzureOpenAISummaryProviderLlamaSummaryProviderOpenAISummaryProvider

Implements: ISummaryProvider

Constructors

C#
protected BaseSummaryProvider()

Properties

ChatClient

IChatClient

Gets or sets the AI chat client used for summarization and question answering.

C#
public IChatClient ChatClient { get; set; }

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

C#
public int MaxTokenCount { get; set; }

Gets or sets the model name used by the AI chat client for processing requests.

C#
public string Model { get; set; }

Gets or sets additional instructions to be appended to the prompt for summarization or question answering.

C#
public string PromptAddition { get; set; }

Implements: ISummaryProvider.PromptAddition

Methods

Asks a question about the specified document and returns the AI-generated answer.

C#
public string AskQuestion(string question, SimpleTextDocument simpleDocument)
Parameters:questionstring

The question to ask.

simpleDocumentSimpleTextDocument

The document to use as context for the question.

Returns:

string

The answer string generated by the AI model.

Implements: ISummaryProvider.AskQuestion(string, SimpleTextDocument)

When implemented in a derived class, creates and initializes the AI chat client.

C#
protected abstract void CreateChatClient()

Generates a summary for the specified document using the AI chat client.

C#
public string GetSummary(SimpleTextDocument simpleDocument)
Parameters:simpleDocumentSimpleTextDocument

The document to summarize.

Returns:

string

A summary string generated by the AI model.

Implements: ISummaryProvider.GetSummary(SimpleTextDocument)

Raises the SummaryResourcesCalculated event.

C#
protected virtual void OnSummaryResourcesCalculated(object sender, SummaryResourcesCalculatedEventArgs e)
Parameters:senderobject

The event source.

eSummaryResourcesCalculatedEventArgs

The event data.

Returns the actual key.

C#
protected virtual string SecureStringToString(SecureString secureString)
Parameters:secureStringSecureStringReturns:

string

Handles the event when summary resources are calculated, allowing execution to continue. Also raises the SummaryResourcesCalculated event for external subscribers.

C#
protected virtual void SummarizationProcessor_SummaryResourcesCalculated(object sender, SummaryResourcesCalculatedEventArgs e)
Parameters:senderobject

The event source.

eSummaryResourcesCalculatedEventArgs

The event data containing summary resource information.

Events

SummaryResourcesCalculated

EventHandler<SummaryResourcesCalculatedEventArgs>

Occurs when summary resources are calculated during summarization.

C#
public event EventHandler<SummaryResourcesCalculatedEventArgs> SummaryResourcesCalculated