The site will use temperature, wind, humidity, precipitation etc to compose the haiku. The background gradient is decided by season, weather and time of day.
The hardest part was getting the AI to write interesting poetry instead of obvious clichés. Working with generative AI feels more like trying to train an animal than programming a computer. You can't just tell it "don't be boring". I ended up with 30+ randomized focus prompts (material reactions, how light changes, human activity, etc) that get mixed into each generation to encourage variety.
Made with vanilla PHP/JS. Happy to answer questions about the prompt engineering or anything else :)
minor_drizzle•1h ago
Haiku has a strict 5-7-5 syllable structure. I had to make the AI respect that, but also be creative with the vocabulary. Setting the "temperature" setting to the max made for the most interesting poems, but also made the AI go off the rails from the haiku rules. The larger models like Gemini 3, and the "thinking" models, made much more varied poetry, but too way too long to generate the text, making them useless from a UX perspective.
As I've understood it, LLMs are probability and pattern matching engines. This is the worst for poetry! Usually we want unexpected metaphors and emotional contrast in poetic language. I think there is still a lot of experimentation to be made, but it's also very hard to evaluate poetry. What is "quality" when it comes to haiku?