Table of Contents

Class Summarizer

Namespace
LMKit.TextGeneration
Assembly
LM-Kit.NET.dll

Provides functionality to generate a summary (title and/or content) from an input text using a language model.

public sealed class Summarizer
Inheritance
Summarizer
Inherited Members

Constructors

Summarizer(LM)

Initializes a new instance of the Summarizer class with the specified language model.

Properties

GenerateContent

Gets or sets a value indicating whether the summarization should include the summarized content body.

GenerateTitle

Gets or sets a value indicating whether the summarization should include a generated title.

Guidance

Gets or sets optional guidance text that can influence the summarization process.

Providing guidance text allows you to nudge the model towards specific styles, tones, or focal points within the summary. For example, you might supply a short phrase or sentence that emphasizes a particular theme, ensures the summary addresses certain user preferences, or adheres to a designated format.

If no guidance is provided, the model will rely solely on the input content and its internal training to produce a summary.

MaxContentWords

Gets or sets the maximum number of words allowed in the summarized content. Value is constrained between 0 and 2000 words.

MaxTitleWords

Gets or sets the maximum number of words allowed in the summarized title. Value is constrained between 0 and 50 words.

MaximumContextLength

Gets or sets the maximum context length (in tokens) that can be used for the model input. Reducing this value can dramatically increase inference speed on CPUs, but may reduce output quality.

Model

Gets the underlying language model used for summarization.

OverflowStrategy

Gets or sets the strategy for handling inputs that exceed the configured MaximumContextLength.

Methods

Summarize(string, CancellationToken)

Generates a summary from the provided content synchronously.

SummarizeAsync(string, CancellationToken)

Asynchronously generates a summary from the provided content.