MediumCrush 1L Year With AI-Powered Tools: Lesson 1. | by legaltextai | Medium
Sitemap

Crush 1L Year With AI-Powered Tools: Lesson 1.

3 min readJun 7, 2023

--

My dear friend, I hear you have taken on the monumental task of studying law! It is a perilous profession, not meant for the faint of heart. Your professors will inundate you with piles of archaic texts, filled with a tangled web of precedents you must unravel to satisfy their high demands.

Press enter or click to view image in full size

Fear not, for I will guide you in training your AI replica to such an extent that it can think and write as well as the finest legal minds in history! Under my tutelage, this skill will amplify your abilities, not replace them.

Our goal here is not to cheat on assignments — rather, it is to mold you into a more capable lawyer by providing you the most powerful tool yet available to the legal profession.

The objective of these short lessons is to prepare you for the first year of law school by establishing a framework that will become your “second brain” — a teaching aid to assist you through the challenging initial year of legal study.

We will explore how to apply large language models and examine the principal approaches to legal reasoning and logic.

By building this foundation before you embark on law school, you will have the tools in place to handle the demanding coursework from the very first day. This “second brain” will help you learn, retain, and analyze legal concepts throughout your first year and beyond.

Again, the goal here is not to teach you every legal subject you will encounter in your 1L year. Rather, it is to show you how to use AI tools to aid you in your learning and make the first year slightly less difficult.

Lesson 1. Querying a legal case.

In your first year of law school, you will have to analyze a staggering number of court cases and legal decisions. Professors expect students to thoroughly brief and answer questions about dozens of cases for each class session.

Get legaltextai’s stories in your inbox

Join Medium for free to get updates from this writer.

Our goal here is to make that work more productive by helping you build a systematic approach to legal analysis. With consistent practice, you will be briefing cases thoroughly and effectively, developing an ever-growing legal “database” in both your memory and your “second brain” to draw from in the future. Let’s start!

  1. Install Anaconda.
  2. You will need an OpenAI API key and, ideally, API keys for Cohere and Anthropic as well. Do not worry if you do not have all the keys yet; OpenAI will suffice to get started. (Cohere and Anthropic currently offer generous free trial access. At this point, Anthropic is my favorite by far.)
  3. Open Jupyter, create a new notebook, and follow along:
#We 'll need to install and import some packages and libraries first 
pip install langchain
import os
from langchain.document_loaders import PyPDFLoader
from langchain.indexes import VectorstoreIndexCreator
os.environ["OPENAI_API_KEY"] = "add your OpenAI API key here"

4. Download a copy of the famous case of Hawkins v McGee and save the pdf to your working folder (name it “hawkins.pdf”).

5. Now, we “read” the file and prepare it for search queries.

loader = PyPDFLoader("hawkins.pdf")
pages = loader.load_and_split()
index = VectorstoreIndexCreator().from_loaders([loader])

6. Let’s run some queries over the case now.

query = "What were the facts of the case?"
response = index.query(query)
print(response)

Replace the query with: “Who was the judge?”, “When was it decided?”, “What were the defendant’s arguments?”, etc.

That’s it for today. We’ve learned something new:

  • Large language models can help analyze legal cases.
  • Analyzing cases through questions and answers can complement the traditional method that involves reading, highlighting, summarizing, and memorizing.

--

--

legaltextai
legaltextai

Written by legaltextai

Gentle introduction of AI tools into the legal education and practice.