Summarize(text)
Synchronous summarization on a string.
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.
Summarize(text)Synchronous summarization on a string.
Summarize(attachment)Document and image summarization through Attachment.
SummarizeAsync(...)Async overloads with cancellation tokens.
SummarizerResultReturns Title, Content, and rich metadata.
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.
RecursiveSummarizeSplits 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.
TruncateProcesses 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.
RejectThrows 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.
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.
Standard semantic summary. The model paraphrases the content into a shorter, coherent piece of prose. Default intent for articles, blog posts, and reports.
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.
Pass a Guidance string to override the default prompt: "Summarize in three bullet points", "Highlight the financial figures", "Focus on the legal obligations".
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}");
Pair with SpeechToText to summarize hour-long calls into key points and action items. Recursive overflow handles any length.
Generate one-line summaries of incoming threads so reps can scan their queue. Title generation gives every email a glanceable headline.
Condense daily articles into a personalised digest. Use TargetLanguage to translate-and-summarize in one pass.
Summarize long contracts and case files with Guidance set to "Highlight liability clauses" or "Extract obligations".
Process academic PDFs with Attachment input. Recursive summarization handles 30-page papers gracefully.
Use SummarizationIntent.Classification to label incoming documents by nature (invoice, contract, resume, complaint) before routing.
SummarizerMain class. Configure Intent, OverflowStrategy, MaxContentWords, MaxTitleWords, TargetLanguage, Guidance. Call Summarize / SummarizeAsync.
SummarizerResultReturned object with Title, Content, source/summary word counts, target language, and elapsed time metadata.
SummarizationIntentEnum: Abstraction, Classification. Selects the prompt template and behaviour profile.
OverflowResolutionStrategyEnum: RecursiveSummarize, Truncate, Reject. Controls behaviour when input exceeds the context window.
Working console demos on GitHub, step-by-step how-to guides on the docs site, and the API reference for the classes used on this page.
Console demo: text summaries with controllable length.
Open on GitHub → DemoConsole demo: section-aware summaries of long documents.
Open on GitHub → How-to guidePick the right summarization intent and overflow policy.
Read the guide → How-to guideEnd-to-end: ingest, chunk, summarize, assemble.
Read the guide →