Class Summarizer
- Namespace
- LMKit.TextGeneration
- Assembly
- LM-Kit.NET.dll
Provides functionality to generate a summary (title and/or content) from various input sources using a language model.
public sealed class Summarizer
- Inheritance
-
Summarizer
- Inherited Members
Remarks
This summarizer supports multiple content types, including plain text, images, PDF documents, HTML files, and Microsoft Office formats (DOCX, XLSX, PPTX).
Use Summarize(string, CancellationToken) or SummarizeAsync(string, CancellationToken) for text input, and Summarize(Attachment, CancellationToken) or SummarizeAsync(Attachment, CancellationToken) for file attachments.
For a complete list of supported file formats, see the Attachment class documentation.
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.
- Intent
Specifies the summarization behavior to apply to the input content. Determines whether the system should classify the content type (e.g., legal, technical, conversational) or generate a condensed semantic summary of its meaning.
- MaxContentWords
Gets or sets the maximum number of words allowed in the summarized content. The value is constrained between 0 and 2000 words.
- MaxTitleWords
Gets or sets the maximum number of words allowed in the summarized title. The 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.
- TargetLanguage
Specifies the preferred language for generated summaries. When set to Undefined (default), the engine attempts to auto-detect the input content language (note: auto-detection may affect performance) and generate the summary accordingly. If explicitly set, the engine makes a best-effort attempt to interpret content and generate the summary in the specified language.
Methods
- Summarize(Attachment, CancellationToken)
Generates a summary from an Attachment synchronously.
- Summarize(ImageBuffer, CancellationToken)
Synchronously generates a summary from the specified image.
- Summarize(string, CancellationToken)
Generates a summary from the provided text content synchronously.
- SummarizeAsync(Attachment, CancellationToken)
Asynchronously generates a summary from an Attachment.
- SummarizeAsync(ImageBuffer, CancellationToken)
Asynchronously generates a summary from the specified image.
- SummarizeAsync(string, CancellationToken)
Asynchronously generates a summary from the provided text content.