AI Magic + Algorithmically-Driven News Feeds Minus the Surveillance Capitalism
David Colaursso
Co-director, Suffolk's Legal Innovation & Tech Lab
This is the 47th post in my series 50 Days of LIT Prompts.
As many internet users of a certain age will tell you, Google Reader was peak Internet. I wanted to bring back some of that magic with a 21st century spin. So, I created My RSS Algo an open source client-side algorithmically-driven RSS reader. It lets users customize their algorithm and timeline behavior while keeping all that training data local, living on the user's computer. There's no login, and the site doesn't even collect analytics (no cookies). Users can manage their feeds, hide/group similar articles, set ratings cutoffs, and use regular expressions to promote or mute certain articles! All without needing to feed someone else's algo.
Back when Twitter stopped being Twitter, I moved to Mastodon, and though I enjoy the community I've found there, I really missed that Twitter feed. Algorithmic feeds are really good for content discovery. They're like a news editor choosing what to put on the front page of the paper. The trick is valuing their contribution without mistaking them for the whole conversation. With My RSS Algo the algorithm works for me. It's everything I've ever wanted in a RSS reader, and if you read last Tuesday's post, you know I coded it with the aid of a large language model (LLM). So, today's post, in which I give the reader LLM-super powers just made sense.
Just like yesterday, today's post will show our template at use out there on the Web! That's right, I added "Magic AI Fairy Dust" to My RSS Algo. Here it's worth noting something about LIT Prompts that often goes unsaid. You don't have to use OpenAI to run your prompts. You could download LM Studio and point to a local LLM, ensuring your data stays on your computer. And so it is with My RSS Algo.
If you navigate to the "Setting" section of My RSS Algo and scroll down to the bottom, you will see a section titled "Magic AI Fairy Dust." Just as you do for LIT Prompts, provide an API base and key. Again, you could use something open like the LLMs available through LM Studio, but if you want to use OpenAI credentials here's the how to. You'll also notice a textarea for you to place your prompt. By default it mirrors the one below except instead of {{highlighted}}
, it uses {{news-feed}}
which is replaced with the titles and introductory sentences of the items in your feed. Once you provide an API key, and refresh the page, the 🤖 button will appear at the top of the reader. Clicking it will trigger your prompt, placing its output at the top of the page.
The default prompt template produces a short briefing on political news in your timeline. But why stop there? You could edit the prompt template and have it provide this summary in verse.
Did My RSS Algo really need LLMs (the new "AI") when it already had machine learning (the old "AI")? Probably not, but now you can add the new "AI" if you like. Better yet, you can keep your data on your device. There's no need to hand them over, at least not until you follow one of the links in your feed. ;) Also, it got you thinking about My RSS Algo. That's a win in my book. I hope you have fun giving it a spin. Maybe you'll build a better prompt than the default.
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
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:
- Select "API keys" from the left menu
- 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:
- open the extension
- click on Templates & Settings
- 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. The idea hear is that you would select the headlines and previews for a bunch of articles and run this template.
Here's the template's title.
Briefing
Here's the template's text.
Read the following list of headlines and introductory sentences then provide a short briefing based on any political news you find.
-----
{{highlighted}}
-----
Now provide your briefing. Keep it short, no more than 100 words!
And here are the template's parameters:
- Output Type:
LLM
. This choice means that we'll "run" the template through an LLM (i.e., this will ping an LLM and return a result). Alternatively, we could have chosen "Prompt," in which case the extension would return the text of the completed template. - Model:
gpt-3.5-turbo-1106
. This input specifies what model we should use when running the prompt. Available models differ based on your API provider. See e.g., OpenAI's list of models. - Temperature:
0
. Temperature runs from 0 to 1 and specifies how "random" the answer should be. Since we're seeking fidelity to a text, I went with the least "creative" setting—0. - Max Tokens:
500
. This number specifies how long the reply can be. Tokens are chunks of text the model uses to do its thing. They don't quite match up with words but are close. 1 token is something like 3/4 of a word. Smaller token limits run faster. - JSON:
No
. This asks the model to output its answer in something called JSON. We don't need to worry about that here, hence the selection of "No." - Output To:
Screen Only
. We can output the first reply from the LLM to a number of places, the screen, the clipboard... Here, we're content just to have it go to the screen. - Post-run Behavior:
FULL STOP
. Like the choice of output, we can decide what to do after a template runs. To keep things simple, I went with "FULL STOP." - Hide Button:
unchecked
. This determines if a button is displayed for this template in the extension's popup window.
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: