Sadly Not, Havoc Dinosaur

AI-assisted LIT Reviews

Create a sphreadsheet of citations found in a paper with only a few keystrokes

Headshot of the author, Colarusso. David Colaursso

This is the 39th post in my series 50 Days of LIT Prompts.

Today's template builds on Tuesday and Wednesday's use of entity extraction. We'll be using an LLM to extract the citations from scholarly articles and save them to a csv file. After that we can add columns to the file to help make finding copies easier and to track if we've read the articles. Finding and reading all the cites in a paper is often part of the larger process of conducting LIT review. Here's the workflow for this AI-assisted portion.

Extract & Clean

  1. Open up your scholarly paper. For this example, I used my own Unsupervised Machine Scoring of Free Response Answers—Validated Against Law School Final Exams.
  2. Select and copy the paper's text into your clipboard.
  3. Paste the paper's text into the LIT Prompts Scratch Pad (accessible from the extension's popup).
  4. Select the text in the Scratch Pad, and run the template. Note: You can't run the template from a PDF, it has to be text inside a proper webpage, hence the need to use the Scratch Pad.
  5. When the template prompts you to save the file, rename it from output.txt to something like cites.csv. If your browser doesn't ask you how to save the file, change the name after it's saved.
  6. Open your csv in your favorite spreadsheet program and add columns that use the title and author to create a web search (e.g., =HYPERLINK(TEXTJOIN("?q=",true,"https://scholar.google.com//scholar",TEXTJOIN(" by ",true,B2,A2)),"Google Scholar")).
  7. Add a column to mark off when you've read the paper.

Pro Tip: If the file you downloaded doesn't open, try opening it with a text editor. There's probably some small formating issue you can fix (e.g., two rows are on the same line or ``` has been placed around the text of the file). Sipily fix the formating and save.

Here's the sheet I produced based on my Unsupervised Machine Scoring paper.

For short papers this works pretty well, but I did try some longer law review articles and it wasn't as good at creating a comprehensive list of citations. Part of this may have been the use of footnotes, but I suspect part of it was also the volume of cites. As always, remember you need to keep LLMs on a short leash. So, my suggestion is that you double check the output. Even with this step, however, I think this still saves you time as you don't have to copy-paste everything.

Let's build something!

We'll do our building in the LIT Prompts extension. If you aren't familiar with the LIT Prompts extension, don't worry. We'll walk you through setting things up before we start building. If you have used the LIT Prompts extension before, skip to The Prompt Pattern (Template).

Up Next

Questions or comments? I'm on Mastodon @Colarusso@mastodon.social


Setup LIT Prompts

7 min intro video

LIT Prompts is a browser extension built at Suffolk University Law School's Legal Innovation and Technology Lab to help folks explore the use of Large Language Models (LLMs) and prompt engineering. LLMs are sentence completion machines, and prompts are the text upon which they build. Feed an LLM a prompt, and it will return a plausible-sounding follow-up (e.g., "Four score and seven..." might return "years ago our fathers brought forth..."). LIT Prompts lets users create and save prompt templates based on data from an active browser window (e.g., selected text or the whole text of a webpage) along with text from a user. Below we'll walk through a specific example.

To get started, follow the first four minutes of the intro video or the steps outlined below. Note: The video only shows Firefox, but once you've installed the extension, the steps are the same.

Install the extension

Follow the links for your browser.

  • Firefox: (1) visit the extension's add-ons page; (2) click "Add to Firefox;" and (3) grant permissions.
  • Chrome: (1) visit the extension's web store page; (2) click "Add to Chrome;" and (3) review permissions / "Add extension."

If you don't have Firefox, you can download it here. Would you rather use Chrome? Download it here.

Point it at an API

Here we'll walk through how to use an LLM provided by OpenAI, but you don't have to use their offering. If you're interested in alternatives, you can find them here. You can even run your LLM locally, avoiding the need to share your prompts with a third-party. If you need an OpenAI account, you can create one here. Note: when you create a new OpenAI account you are given a limited amount of free API credits. If you created an account some time ago, however, these may have expired. If your credits have expired, you will need to enter a billing method before you can use the API. You can check the state of any credits here.

Login to OpenAI, and navigate to the API documentation.

Once you are looking at the API docs, follow the steps outlined in the image above. That is:

  1. Select "API keys" from the left menu
  2. Click "+ Create new secret key"

On LIT Prompt's Templates & Settings screen, set your API Base to https://api.openai.com/v1/chat/completions and your API Key equal to the value you got above after clicking "+ Create new secret key". You get there by clicking the Templates & Settings button in the extension's popup:

  1. open the extension
  2. click on Templates & Settings
  3. enter the API Base and Key (under the section OpenAI-Compatible API Integration)

Once those two bits of information (the API Base and Key) are in place, you're good to go. Now you can edit, create, and run prompt templates. Just open the LIT Prompts extension, and click one of the options. I suggest, however, that you read through the Templates and Settings screen to get oriented. You might even try out a few of the preloaded prompt templates. This will let you jump right in and get your hands dirty in the next section.

If you receive an error when trying to run a template after entering your Base and Key, and you are using OpenAI, make sure to check the state of any credits here. If you don't have any credits, you will need a billing method on file.

If you found this hard to follow, consider following along with the first four minutes of the video above. It covers the same content. It focuses on Firefox, but once you've installed the extension, the steps are the same.


The Prompt Pattern (Template)

When crafting a LIT Prompts template, we use a mix of plain language and variable placeholders. Specifically, you can use double curly brackets to encase predefined variables. If the text between the brackets matches one of our predefined variable names, that section of text will be replaced with the variable's value. Today we'll be using {{highlighted}}. See the extension's documentation.

The {{highlighted}} variable contains any text you have highlighted/selected in the active browser tab when you open the extension.

For a breakdown of how to use this template, check out the workflow above: Extract & Clean.

Here's the template's title.

Get citations from selected

Here's the template's text.

I'm about to show you a selection of text from an academic paper, complete with citations to other works. Your job is to find all the citations and produce the text for a csv file containing a row for each citation. The csv should have the following headers: "author", "title", "name_of_publication", and "date". Consequently, each row should have the following data all encased in double quotes: author, title, name of publication, and date. Be sure to add a carriage return/line break to the end of each row, including the header row. If part of the information isn't available return "unknown" for that part. 

TEXT FROM ACADEMIC PAPER

{{highlighted}}

---

Now provide a line for the header and each citation (row) in the csv file. Return only the text of the file. Do NOT place it in quotes or provide any extraneous text, just the header and rows. 

And here are the template's parameters:

Working with the above template

To work with the above template, you could copy it and its parameters into LIT Prompts one by one, or you could download a single prompts file and upload it from the extension's Templates & Settings screen. This will replace your existing prompts.

You can download a prompts file (the above template and its parameters) suitable for upload by clicking this button:


Kick the Tires

It's one thing to read about something and another to put what you've learned into practice. Let's see how this template performs.