👩‍⚖️
LegalPromptGuide.com
  • Your FREE Guide to Mastering Legal Prompt Engineering with ChatGPT
  • 1. Introduction to Legal Prompt Engineering (LPE)
  • 2. Practical Prompt Engineering Strategies & Techniques
    • 2.1. Prompt Templates
      • 2.1.1. Summarization
      • 2.1.2. Classification
      • 2.1.3. Extraction
    • 2.2. Few-Example Prompting
  • 3. Real-world Applications of Prompt Engineering in Law
  • 4. Advanced Prompt Engineering
    • 4.1. Prompt Chaining
    • 4.2. Output Parsers
      • 4.2.1. Markdown
      • 4.2.2. HTML
      • 4.2.3. Graphviz (Dot Language)
    • 4.3. ChatGPT Plugins
    • 4.4. ChatGPT Code Interpreter
  • 5. AI Model Selection and Optimization for Legal Practice
  • 6. Implementing Responsible AI Usage at Your Law Firm
  • 7. Research Corner
    • 6.1. LLMs as Tax Attorneys
    • 6.2. Prompt Engineering for Legal Judgement Prediction
  • Appendix
    • Pro Tips!
      • Pro Tip #1
    • References
    • Change Log
Powered by GitBook
On this page
  1. 2. Practical Prompt Engineering Strategies & Techniques
  2. 2.1. Prompt Templates

2.1.3. Extraction

Previous2.1.2. ClassificationNext2.2. Few-Example Prompting

Last updated 1 year ago

LLMs can also effectively extract information from large volumes of text. Common use cases involving extraction prompts include, but are not limited to:

  • Information Retrieval: Extracting specific information from large datasets or complex documents, like identifying key terms, phrases, or sections in legal documents.

  • Named Entity Recognition (NER): Extracting named entities such as people, organizations, locations, dates, etc. from a text.

  • Event Extraction: Identifying and extracting key events, participants, etc. from a given text.

Example: Corporate Organizational Charts

The blockchain industry has had a string of tumultuous events shakeup the recently. Arguably, the most infamous event was the collapse of FTX, the once high-flying cryptocurrency exchange and hedge fund that filed for bankruptcy in November of 2022. To be more specific, FTX, and over 100 of its subsidiaries filed for bankruptcy. Imagine the amount of effort required from bankruptcy lawyers to uncover the intricacies of the relationships between all these corporate entities into something that can be easily understood... Enter ChatGPT 🙂

The example prompt below demonstrates how we can perform NER extraction to compile an organizational chart.

Prompt:
Identify all corporate entities (businesses), along with their parent companies, 
subsidiaries, and affiliates in the text below. Output in dot language.

Text:
Plaintiff Securities and Exchange Commission (the “SEC” or the “Commission”) for 
its Complaint against Defendants Coinbase, Inc. (“Coinbase”) and Coinbase Global, Inc. 
(“CGI”) (collectively, “Defendants”). CGI—Coinbase’s parent company to which 
Coinbase’s revenues flow—is a control person of Coinbase and thus violated the same 
Exchange Act provisions as Coinbase.

This is a contrived example, but it shows that we can direct ChatGPT to extract specific types of information along with additional metadata. Here, we're not simply asking for an exhaustive list of all corporate entities mentioned in the text, we also want to understand the relationships between these entities. You can see our interaction with ChatGPT using this prompt . Something that we haven't seen yet, but will be discussed at length in are "Output Parsers." In our example prompt above, we provide ChatGPT with a specific instruction – "Output in dot language." ChatGPT keeps things simple, it receives text as input, and returns text as output. One thing that many users don't realize, is that we can ask ChatGPT to return different types of text, text that has specific syntactical meaning, text that represents a computer programming language, etc. In this example, we're interested in generating some type of visual representation of an organizational chart. In this prompt, we are asking ChatGPT to provide its response in Dot language (used to generate visual diagrams–will be covered in ). We can take the Dot language response provided by ChatGPT to generate an image like the one below:

Extraction prompts can be used heavily by law firms to solve a variety a different problems. In the next section, we'll present an example that uses extraction with few-example prompting to automate a common workflow dreaded by countless attorneys and paralegals.

here
chapter 4
chapter 4
This image was generated via ChatGPT's response: digraph { "Coinbase Global, Inc." -> "Coinbase, Inc." [label="Parent"] }