Solutions · Text Generation · Content summarization

Summarize any input, any size.

The Summarizer engine condenses text, images, and document attachments into accurate summaries with configurable length, target language, and intent. Adaptive overflow strategies handle inputs larger than the model's context window through recursive summarization, and an optional title generator gives you a usable headline alongside the body.

Recursive overflow Target language Title generation

Summarize(text)

Synchronous summarization on a string.

Summarize(attachment)

Document and image summarization through Attachment.

SummarizeAsync(...)

Async overloads with cancellation tokens.

SummarizerResult

Returns Title, Content, and rich metadata.

Overflow handling

When the document doesn't fit, summarize anyway.

Summarization fails for most pipelines the moment input exceeds the model's context window. Summarizer doesn't fail. Pick an overflow strategy and the engine adapts its approach to the input size.

RecursiveSummarize

Splits the document into chunks, summarizes each chunk, then summarizes the combined chunk-summaries. Handles arbitrarily large inputs while preserving overall meaning. Recommended for long-form content like books, transcripts, and reports.

Truncate

Processes the first portion of the input that fits within the context window, ignoring the rest. Faster than recursive but loses tail content. Best when the lead paragraph carries the message.

Reject

Throws if the input exceeds capacity. Use when you'd rather know there's a problem than ship a partial summary. Pairs well with explicit chunking upstream.

Intents

Tell the engine what kind of summary you need.

SummarizationIntent lets you steer the model between high-level paraphrase, factual classification, and domain-specific analysis. The engine tunes its prompt accordingly so you don't have to engineer one yourself.

Abstraction

Standard semantic summary. The model paraphrases the content into a shorter, coherent piece of prose. Default intent for articles, blog posts, and reports.

Classification

Names the nature of the input rather than restating it: "This is a legal NDA", "This is a Python stack trace", "This is a customer complaint". Useful for routing and triage.

Custom guidance

Pass a Guidance string to override the default prompt: "Summarize in three bullet points", "Highlight the financial figures", "Focus on the legal obligations".

Code sample

Configurable in 10 lines.

Summarizer.cs
using LMKit.Model;
using LMKit.TextGeneration;

var model = LM.LoadFromModelID("mistral-small3.2");

var summarizer = new Summarizer(model)
{
    Intent = Summarizer.SummarizationIntent.Abstraction,
    OverflowStrategy = Summarizer.OverflowResolutionStrategy.RecursiveSummarize,
    GenerateTitle = true,
    GenerateContent = true,
    MaxContentWords = 150,
    MaxTitleWords = 10,
    TargetLanguage = Language.English,
    Guidance = "Highlight financial figures and obligations."
};

var annual = File.ReadAllText("annual-report-2025.txt");
SummarizerResult result = await summarizer.SummarizeAsync(annual);

Console.WriteLine($"Title:   {result.Title}");
Console.WriteLine($"Summary: {result.Content}");
Console.WriteLine($"Source words: {result.SourceWordCount}");
Console.WriteLine($"Summary words: {result.SummaryWordCount}");
Applications

Where summarization scales.

Meeting transcripts

Pair with SpeechToText to summarize hour-long calls into key points and action items. Recursive overflow handles any length.

Email triage

Generate one-line summaries of incoming threads so reps can scan their queue. Title generation gives every email a glanceable headline.

News aggregation

Condense daily articles into a personalised digest. Use TargetLanguage to translate-and-summarize in one pass.

Legal review

Summarize long contracts and case files with Guidance set to "Highlight liability clauses" or "Extract obligations".

Research literature

Process academic PDFs with Attachment input. Recursive summarization handles 30-page papers gracefully.

Document classification

Use SummarizationIntent.Classification to label incoming documents by nature (invoice, contract, resume, complaint) before routing.

Developer Resources

API reference.

Summarizer

Main class. Configure Intent, OverflowStrategy, MaxContentWords, MaxTitleWords, TargetLanguage, Guidance. Call Summarize / SummarizeAsync.

View documentation

SummarizerResult

Returned object with Title, Content, source/summary word counts, target language, and elapsed time metadata.

View documentation

SummarizationIntent

Enum: Abstraction, Classification. Selects the prompt template and behaviour profile.

View documentation

OverflowResolutionStrategy

Enum: RecursiveSummarize, Truncate, Reject. Controls behaviour when input exceeds the context window.

View documentation

Compress long content. Keep meaning intact.

Get Community Edition Download