Sadly Not, Havoc Dinosaur

The Elements of Interactive Style Guides

Have AI provide writing feedback based on a house style guide

Headshot of the author, Colarusso. David Colaursso

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

Yes, this week's theme seems to be talking to robot writing assistants while drinking coffee at a cafe. Well, that and the idea that you should feed more words into a large language model (LLM) than you ask it to output. We do this to mitigate hallucinations along with other issues. We will continue this approach with today's template, The Elements of Interactive Style Guides. Here's how it works, you highlight some text you want to "clean up," and it responds with suggestions based on a style guide provided by you. If you like, you can start a "conversation" to further refine your writing.

Here's the text I want to clean up.

In 1788 the King's advisers warned him that the nation was facing bankruptcy therefore he summoned a body called the States-General believing that it would authorize him to levy new taxes. The people of France however were suffering from burdensome taxation oppressive social injustice and acute scarcity of food and their representatives refused to consider projects of taxation until social and economic reforms should be granted. The King who did not realize the gravity of the situation tried to overawe them collecting soldiers in and about Versailles where the sessions were being held. The people of Paris seeing the danger organized militia companies to defend their representatives. In order to supply themselves with arms they attacked the Invalides and the Bastille which contained the principal supplies of arms and munitions in Paris.

Some of you may recognize this as an exercise from the 1920 edition of The Elements of Style by William Strunk, Jr. (which unlike the Strunk and White version is available on Project Gutenberg).

What follows is output from today's template when fed the above text and the first six chapters of Strunk. This is followed by an ask from me and the LLM's reply. FWIW, the exercise above shows up in chapter seven. So, it's inclusion in the prompt is only as the text we want to "clean up." That being said, it's all over the web. So, we can be sure it, and maybe some worked examples, are in our LLM's training data. You'll have to feed our template some original text to give it a proper test. And of course, you can use your own house style guide instead of The Elements of Style.

In my followup prompt, I asked the LLM to go ahead and make the edits. Interestingly, it only replaced in full four of it's six suggestions. The evaluation and improvement of the prompt template is left as an exercise for the reader. ;)

Below I'll show you how to put together the elements needed to create your own interactive style guide. That being said...

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

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 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 Patterns (Templates)

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 {{passThrough}} and {{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. We use the Post-run Behavior parameter to govern what happens after a template is run. If you use Post-run Behavior to send one template's output to another template, the first template's output can be read by the second template via the {{passThrough}} variable. To make it easy for you to insert your own style guide:

  1. I created a template that provides writing feedback based on the content of the {{passThrough}} for a the text found in the {{highlighted}} variable when passed to an LLM.
  2. I created a template containing the text of the style guide, setting the Output Type to Prompt and the Post-Run Behavior to the name of the above template (i.e., "Generate feedback"), and checking the "Hide Button" checkbox. Note: I did it in this order so I could select the firt templates name as the post-run destination.

Here's the first template's title.

Generate feedback

Here's the template's text.

You are an editor helping a writer improve a piece. To refresh your memory I'm going to show you a copy of your house style guide. This will be followed by the writer's text. After this, I'll ask you to provide some helpful feedback on the piece based on the style guide.








Provide helpful feedback based on the suggestions found in House Style Guide. Provide your advice along with quotes from where you suggest an edit.

And here are the template's parameters:

Here's the second template's title.

The House Style Guide

Here's the template's text.

[the first six chapters of the 1920 edition of The Elements of Style by William Strunk, Jr.]

And here are the template's parameters:

Working with the above templates

To work with the above templates, you could copy them and their 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.

TL;DR References

ICYMI, here are blubs for a selection of works I linked to in this post. If you didn't click through above, you might want to give them a look now.