Document Summarization


The Gradient Accelerator Block for document summarization efficiently summarizes documents and excerpts into a high-quality snapshot of key points, leveraging user-provided style examples or length guidance.

Document summarization can be used to extract insights from news articles or synthesize customer conversations, allowing users to save time and focus on higher level tasks.

Create an account and workspace

If you haven't already, go to, click sign up and create your account. Once you have verified your email, log in to the account. Click "Create New Workspace" and give it a name.

You can see your workspaces at any time by going to

Use the Accelerator Blocks playground

You can easily try out the Gradient Accelerator Block for document summarization via the playground UI.

  1. Log into Gradient and select the workspace you want to use. Select the “Accelerator Blocks” tab from the left sidebar.

  2. Navigate to the “Document Summary” block.

  3. Insert the text or excerpt into the input. Optionally, select a length for the summary or provide a few of your own summarization examples.

    1. Length – The model will use this as an approximate guidance to generate the summary. The exact length is not guaranteed.
    2. Training examples – These document + summary example pairs are provided to tune the model to follow user preferences for summaries. The model will learn the tone, style, and key points to follow when summarizing. We recommend providing at least 5 examples for optimal effectiveness.
  4. Hit “Submit” and a summary should be generated below!

Use the SDK

The SDK is best suited for integrating document summarization into your application or business workflow.

Follow our SDK Quickstart to get set up. From there, simply provide your document for summarization and (optionally) the desired length or training examples.

from gradientai import SummarizeParamsLength

document = (
    "In the days ahead of the Vision Pro's launch, Apple has heavily "
    + "promoted some of the apps destined for its spatial computing "
    + "headset. Download Disney Plus and watch movies from Tatooine! "
    + "Slack and Fantastical and Microsoft Office on your face! FaceTime "
    + "with your friends as a floating hologram! But it's increasingly "
    + "clear that the early success of the Vision Pro, and much of the "
    + "answer to the question of what this headset is actually for, will "
    + "come from a single app: Safari.\n\nThat's right, friends. Web "
    + "browsers are back. And Apple needs them more than ever if it wants "
    + "this $3,500 face computer to be a hit. Embracing the web will mean "
    + "threatening the very things that have made Apple so powerful and "
    + "so rich in the mobile era, but at least at first, the open web is "
    + "Apple's best chance to make its headset a winner. Because at least "
    + "so far, it seems developers are not exactly jumping to build new "
    + "apps for Apple's new platform."
examples = [
        "document": (
            "Historically, Apple is unmatched in its ability to get app "
            + "makers to keep up with its newest stuff. When it releases "
            + "features for iPhones and iPads, a huge chunk of the App "
            + "Store supports those features within a few weeks. But so "
            + "far, developers appear to be taking their Vision Pro "
            + "development slowly. Exactly why varies across the App "
            + "Store, but there are a bunch of good reasons to choose "
            + "from. One is just that it's a new platform with new UI "
            + "ideas and usability concerns on a really expensive device "
            + "few people will have access to for a while. Sure, you can "
            + "more or less tick a box and port your iPad app to the "
            + "Vision Pro, but that may not be up to everyone's standards."
        "summary": (
            "Apple typically releases hardware first with app support "
            + "added over a few weeks. However, fewer developers are "
            + "supporting the Vision Pro over the first few weeks of "
            + "its release."

result_from_examples = gradient.summarize(

length = SummarizeParamsLength.MEDIUM
result_from_length = gradient.summarize(document=document, length=length)