Surface AI
Mar 22, 2023
How Surface AI Works
The working of Surface AI is a blend of complexity and simplicity. It connects to various RSS feeds that are a rich source of AI-related content via Feedly API. Using the power of GPT-4, it processes this sea of information, identifying the articles that are most likely to be of interest. It’s a seamless process that works behind the scenes, presenting me with a curated list of reads that match my specific interests.

Ranking Articles
The architecture of my newsletter revolves around two main components — a parser and a recommender. Each section in the newsletter, be it ‘AI News Highlights’ or ‘New AI Tools’, is fed into the system through a dedicated parser.
This parser, tasked with the role of a translator, takes the influx of information from a Feedly stream and transforms it into a format that’s easy to digest for a Large Language Model. This conversion process results in the creation of an object that’s ready to be served to the recommender.
The recommender, on the other hand, takes up the mantle of a personal curator. It receives a collection of articles, each represented as a string, and its job is to rank these articles. But this ranking isn’t arbitrary. It’s a thoughtful process, designed to prioritize articles based on my unique interests.

The operational flow of this system can be envisioned through a simple, yet effective prompt, which goes something like this:
I'm a startup founder who's passionate about AI
Reply with your top {{n_resources}} non-duplicate resources on AI.
Add witty descriptions {{ explain }} in up to 3 sentences as a professional copywriter.
Choose from the list of {{resources}}.
Order your recommendations by {{ prioritization }},
and make sure to reply in the following valid JSON structure:
[{"articleIndex": index, "shortExplanation": short description }, ..., {"articleIndex": index, "shortExplanation": short description }].
This is the actual prompt I started with, but over time I upgraded to using LangChain and Guardrails to gain more control over the output.
Crafting the Email
Once the structure of the email was encapsulated in Python code, the next step on the journey was to morph it into Markdown. This transformation, though it might sound complex, was made remarkably straightforward thanks to Jinja. The result of this process was a neatly packaged .md file.
The journey didn’t stop there, though. The markdown representation needed to be converted to HTML, paving the way for the aesthetically pleasing Tailwind CSS design to be integrated into the loop.
The rhythm of this entire process is set to the beat of a weekly schedule, happening automatically without fail. To deliver the final product, I employ the services of SendGrid, ensuring the resulting email lands safely in my inbox.
Made with 🤍 & AI by TP