Skip to content

Prompting for Summarization | Lecture 12

Prompting for Summarization

Learn how to use prompts for summarizing long texts and extracting specific information. Master techniques for getting concise summaries and structured data from AI. Lecture 12

Getting the Gist of It

Welcome back. One of the most common and practical uses for AI is dealing with large amounts of text. Whether it’s a long article, a business report, or a series of emails, AIs can help us quickly understand what’s important.

Today, we’ll focus on two related skills: summarization (getting the main ideas) and information extraction (pulling out specific pieces of data).

Prompting for Summarization

A simple prompt like

"Summarize this article"

can work, but we can do much better by being specific about what we need in the summary.

Key Techniques for Better Summaries

  1. Specify the Length: How long should the summary be? A single sentence? A paragraph? Three bullet points?
  2. Define the Audience and Goal: Who is the summary for? This helps the AI choose the right level of detail and tone.
  3. Focus on a Specific Aspect: You don’t always need a general summary. You can ask the AI to summarize with a focus on a particular topic.

Advanced Summarization Prompt

I am a busy executive. Summarize the following business report for me in three concise bullet points. Focus specifically on the financial outcomes and the key recommendations for next quarter.

[Paste the full report text here]

Prompting for Information Extraction

Sometimes you don’t need a summary; you need specific, structured data from a piece of text. This is called information extraction.

The best way to do this is to tell the AI exactly what pieces of information you’re looking for and what format you want them in. This is where requesting a specific output format like JSON or a table becomes incredibly powerful.

Information Extraction Prompt (to JSON)

From the following customer email, extract the following information:
*   Customer's full name
*   Order number
*   The specific issue they are reporting

Provide the output as a JSON object with the keys "customerName", "orderId", and "issue". If any information is missing, use a value of null.

Email Text:
"""
Hello,

My name is Najeeb Alam and I'm having a problem with my recent order, #T56-B3. The screen on the device you sent me is cracked. I need to know how to return it.

Thanks,
Najeeb
"""
Expected AI Response:
{
  "customerName": "Najeeb Alam",
  "orderId": "#T56-B3",
  "issue": "The screen on the device is cracked."
}
Combining Summarization and Extraction

You can do both at the same time! You can ask for specific data points and a brief summary in the same prompt.

From the report provided, extract the total revenue and net profit, and then provide a one-paragraph summary of the report's overall conclusion. Format the extracted data as a JSON object.

Prompting for Summarization
Prompting for Summarization

Key Takeaways from Lecture 12

  • For summarization, specify the desired length, audience, and focus.
  • For information extraction, clearly state what data points you need.
  • Using a structured output format (like JSON, a list, or a table) is the best practice for extraction.
  • Use delimiters (like “` or “””) to clearly separate the text you want the AI to work on from your instructions.
  • You can combine these techniques in a single prompt to get both extracted data and a summary.

End of Lecture 12. You’re now equipped to handle large documents with ease. Next up, a very popular topic: how to use prompt engineering to generate and debug computer code.

Creative Content Generation | Lecture 11

Najeeb Alam

Najeeb Alam

Technical writer specializes in developer, Blogging and Online Journalism. I have been working in this field for the last 20 years.