# 2.1.1. Summarization

LLMs like ChatGPT are really good at summarizing information for us. To get the most out of having LLMs summarize large volumes of text, you can provide a template that not only details your desired formatting, but also includes placeholders for the types of information you want included.

Let's take a look at a simple example regarding the Securities Act of 1933 starting with your basic prompt asking for a summary:

```
Basic Prompt W/O Template:
Summarize the Securities Act of 1933
```

When given this prompt, ChatGPT will do an okay job at producing at a summary that is legible and informational. Take a look at the response we received [here](https://chat.openai.com/share/9dac8f14-e1f1-4082-bd6d-13d4bec30322). How can we get ChatGPT to generate a better summary? We can use a prompt template that better instructs the AI on the specific types of information you're interested in (dates, persons, etc.), formatting preferences, desired length, and more. Take a look at the following prompt:

<pre><code>Detailed Summary Prompt Template:
As a legal professional, analyze the securities act of 1933 and generate a 
detailed summary with 3-4 highlights for each of the most important sections 
with important keywords, people, numbers, and facts in this format:

<a data-footnote-ref href="#user-content-fn-1">#</a> <a data-footnote-ref href="#user-content-fn-2">{title here}</a>

<a data-footnote-ref href="#user-content-fn-3">###</a> {section title here}

<a data-footnote-ref href="#user-content-fn-4">{START_DETAILS_SECTION}</a>
{summary of the section with important keywords, people, numbers, and facts}

- {first point}: {short explanation with important keywords, people, and facts}
- {second point}: {same as above}
- {third point}: {same as above}
<a data-footnote-ref href="#user-content-fn-5">&#x3C;!-- a fourth point if warranted, and so on --></a>
<a data-footnote-ref href="#user-content-fn-6">{END_DETAILS_SECTION}</a>

### {second section here}

{START_DETAILS_SECTION}
{summary of the section with important keywords, people, numbers, and facts}

- {first point}: {short explanation with important keywords, people, and facts}
- {second point}: {same as above}
- {third point}: {same as above}
&#x3C;!-- a fourth point if warranted, and so on -->
{END_DETAILS_SECTION}

### {third section here}
&#x3C;!-- and so on, as many sections and details/summary subpoints as warranted -->

End with other questions that the user might want answered based on this source:

### Further information
- {question + answer 1}
- {question + answer 2}
- {question + answer 3}

All words in brackets must replaced by the summary of the content.
<a data-footnote-ref href="#user-content-fn-7">Only draw from the source content, do not hallucinate.</a>

Only output the response in the prescribed format with NO additional commentary. 
Answer the questions included in the "Further information" section and display 
the answer alongside the question.
</code></pre>

Follow along with us as we prompt ChatGPT using this template [here](https://chat.openai.com/share/3346e40f-5f78-4a1e-adce-c1ab3174f6e7). There is a lot to digest in this prompt template, but for starters don't shy away from the weird syntax being used. This syntax is called [Markdown](https://en.wikipedia.org/wiki/Markdown) and can be used to format raw text using headings, lists, and other elements you are used to seeing in Microsoft Word and Google Docs. It's great at helping guide the AI model towards producing a response in a prescribed format, but also allows you to embed instructions within as well, a good example being the list of important keywords, people, and facts we want generated for each section as illustrated:

```
...
- {first point}: {short explanation with important keywords, people, and facts}
...
```

Hover over the annotated sections of our improved prompt template above to learn more about the specific characteristics we included in this prompt and how they work together. We encourage you to tinker with this template to see if you can get even more precise summaries based on your particular use case. For example, if your law firm prefers to have case files, or legal analysis drafted in a desired format with specific criteria regarding the information that should be included, go ahead and modify the prompt template and see how ChatGPT responds. Remember, prompt engineering is an iterative process.

[^1]: The "#" character is used for document headings.&#x20;

[^2]: This is a placeholder. The AI will replace all text within curly braces ("{}") with generated content.

[^3]: "###" is used for page subheadings.

[^4]: This special placeholder text informs the AI the beginning of detailed information for a particular section of content.

[^5]: Any text found within "\<!-- ... -->" is a template comment/annotation used to help guide the AI. These are omitted from the model's response.

[^6]: This special placeholder text informs the AI the end of the details section.

[^7]: We want to prevent the LLM from hallucinating and including information in the summary that is inaccurate or completely fabricated.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.legalpromptguide.com/2.-fundamentals-of-legal-prompt-engineering/2.1.-prompt-templates/2.1.1.-summarization.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
