Sadly Not, Havoc Dinosaur

TL;DR LLM

Blurb a webpage for social media

Headshot of the author, Colarusso. David Colaursso

This is the 22nd post in my series 50 Days of LIT Prompts.

Functionally, today's template, which creates a short summary of a webpage for sharing on social media, is a special-use adaptation of our very first prompt template. However, I would like to use this familiar task to explore two new ideas. First, the fact that you can create special-use versions of existing templates, and second, how one can use the CHAT behavior to do more than question content.

Ubiquity Breeds Innovation. I used to teach high school physics. I started teaching before the ubiquity of computer projectors in the classroom. I had a computer at my desk, but it wasn't a classroom tool. At some point, I save a video projector from the trash for my classroom. It was much larger than the computer, but I didn't have to move it around. At first, I used it mostly to play DVD's for class. However, having connected it to my computer, I started sharing this or that website with my class. We could get data in real-time to answer questions. I could "take students to the library" during class. It turned "my computer" into a "classroom computer." I even built and shared simulations with my students. From 2023 these uses seem obvious, but at the time (around the turn of the century), a lot of folks weren't sure why I had saved the projector from the scrap bin. To be honest, I mostly thought it would be nice not having to roll in the video cart when I wanted to play a DVD. However, having it there and always ready to use meant I could use it for less and less "important" things. The cost in time to get the projector was no longer a part of the cost benefit analysis, and it turned out that all those small "unimportant" 30 second shares were far more useful than the original use case (playing videos). My experience with LLMs in the browser has been similar. I have two or three dozen custom prompt templates living in my browser right now. They summarize webpages, clean up text, provide boilerplate, serve as sounding boards, and much more. I only discovered these uses, however, because the cost of playing around was so small. If you've been reading these post and not building your own templates, you really should get the LIT Prompts extension and start following along in earnest. Once your own tweaked version of a template is a click or two away, you'll discover all sorts of uses. Which is to say, ubiquity allows for experimentation, which breeds innovation. ;)

CHAT as a tool for shaping outputs. Something you've no doubt faced while working through your own prompt templates if how often outputs are close but not exactly what you were looking for. Here it's worth noting that we can use a chat interface to do more than ask questions. We can use it to shape outputs. In prior summarization templates we worked hard to mitigate hallucinations by constraining the LLM's replies to our questions. That is, we tried to limit the LLM's output. If, however, we allow for a little more wiggle room, we can reference prior outputs in the context of a chat and ask for changes. Consider the following example.

Here's an output today's template provided when run on the 50-days of LIT Prompts home page.

Learn prompt engineering and explore the world of generative AI with LIT Prompts. Build custom interactions and workflows without any coding. #AI #PromptEngineering #LITPrompts

I responded, "include some examples in the post," and I got the following reply.

Learn prompt engineering and explore the world of generative AI with LIT Prompts. Build custom interactions and workflows without any coding. #AI #PromptEngineering #LITPrompts

🔹 Discover how to turn words into numbers and turn scholarly papers into chatbots.
🔹 Craft simple training simulations with "AI actors" and translate text into multiple languages.
🔹 Automate law students and draft multiple choice questions with AI.
🔹 Generate RPG outcomes and blurb webpages for social media. #ArtificialIntelligence #Technology #Education

That seemed a bit long. So, I replied, "make it shorter" and got:

Discover prompt engineering with LIT Prompts: build custom AI interactions without coding. Turn papers into chatbots, automate law students, and generate RPG outcomes. #AI #PromptEngineering #LITPrompts

That last post still needs some editing, but I think you get the idea. 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 @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 {{innerText}}. See the extension's documentation.

The {{innerText}} variable will be replaced by the innerText of your current page (roughly speaking the hard-coded text of a page). In the template below, you'll see {{innerText}} on line 1 followed by a short instruction. To run the template you simpily navigate to the page you want to blurb and execute.

Here's the template's title.

Blurb for social media

Here's the template's text.

{{innerText}}

Write a super short blurb, only a sentence or two, for the above article to accompany a link on social media. Fit it into the size of a Tweet. Add one or three appropriate hashtags. But seriously, keep it short!

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. Note, a lot of these tasks echo those from when we kicked the first template's tires, but there are some new things mixed in.


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.