Chapter 3a: Summarization

"Summarization" is a machine learning problem where you take a piece of text and shrink it.

The following is called a "zero-shot summarizer." It is called zero-shot because we don't provide an example output to the AI.

Until around 2020, this used to be a very difficult problem that required machine learning experts, training data, and specialized models.

And then LLMs came along.

No machine learning required. Just a simple API call.

Here is our summarizer:

async function summarizer(text) {
    const botResponse = await sendPost("https://acme-ai.com/v1/chat", {
        sender: "user",
        message: `
            ${text}

            Please summarize the above text in simple language, in 1 paragraph of about 100 words.
        `
    })

    return botResponse.message;
}