About this app

This app is for demonstration purposes and hopefully it produces funny or beautiful stuff sometimes!


This app is a very basic use of generative AI. There is a chance that the model will hallucinate some content and that it displays some offensive content. I used the Google safe filter, so theoretically the content should be safe. But with any cutting edge project and especially with AI, we cannot be 100% certain of what the machine will spit out!. I personally am not assiociated with this content and it doesn't reflect my views in any shape or form. If you find offensive content, please signal it to me and I will remove it ASAP!

How it works - the tech stack.

In order to produce some daily changing content, the app fetches some news titles every day. Then it uses a generative AI model to generate haikus based on the news titles. Let's look at it step by step

Generate Haikus architecture

1. Fetch news titles

The Guardian API is used to fetch the news titles. The API specs can be found at The Guardian API. The process is scheduled every day using Vercel Cron. Once the news titles are fetched, they are stored in a Firestore database.

2. Generate Haikus

Either at regular time intervals or upon user request, the app fetches the news titles from the Firestore database. Then it uses a generative AI model to generate haikus based on the news titles. The model is the Gemini 1.0 Pro from Google. I worked on the prompt in order to try and have the LLM generate haikus which are based on the news titles, but as well respect the 5-7-5 syllable structure. This turned out to be pretty difficult as with my current prompt Gemini seems to have a hard time generating Haikus which at the same time makes sense and respect the 5-7-5 syllable structure. I am using a few-shot prompting technique, i.e. including several examples of ideal behaviour to nudge the model into the right direction. I am looking into using more Japanese models in the future, as they might be more adapted to this task - but I would need to edit the architecture as well.

3. Display Haikus

In order to display haikus, the app uses a Next.js framework and Vercel hosting. The haikus are fetched from Firebase and displayed on the screen. The components and pages involved in the displaying part of the haikus are all server-rendered, generated on demand. I will need to work into this and add a cache mechanism to enhance app performance.

4. Generate Haikus

In order to protect the haiku generation from spamming, the "generate haiku" feature requires authentication. The authentication is done using Clerk, a service that provides authentication as a service and a lot of very handy features to integrate into a Next.js app.


Ideas rejected


Future improvements