HuggingFace — Text Summarization
hf_inference.nlp.summarizeSummarize a long text into a shorter, coherent paragraph using the facebook/bart-large-cnn model via HuggingFace Inference API. Trained on CNN/DailyMail news articles; works well for factual prose. Control output length with max_length (token cap) and min_length (token floor) parameters. Custom model override supported (e.g. google/pegasus-xsum for extreme single-sentence summaries). Useful for article digests, executive summaries, and reducing LLM context window usage.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Input text to process. Maximum ~10,000 characters depending on model context window. | |
| model | No | HuggingFace model ID to use for summarization. Default: "facebook/bart-large-cnn" (trained on CNN/DailyMail, excellent for news and articles). Alternatives: "sshleifer/distilbart-cnn-12-6" (faster, lighter), "google/pegasus-xsum" (extreme summarization, single sentence). | |
| max_length | No | Maximum number of tokens in the generated summary (20–1024). Default: model-controlled (typically ~150 tokens for BART-large-CNN). Set lower for shorter summaries (e.g. 60 for a single-sentence abstract). | |
| min_length | No | Minimum number of tokens in the generated summary (10–512). Prevents very short or empty summaries. Default: model-controlled (typically ~30 tokens). Set min_length lower than max_length. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | Present only when the call failed. Includes error code, message, request_id, and any provider-specific extras. | |
| result | No | Tool response payload. Shape varies per tool — consult the tool description and inputSchema. May be an object, array, string, or number depending on the upstream provider response. |