note: all news-sources, prompt, and text material are in Swedish, documentation in english
This is a small example program that shows how prompt engineering can be done using the ChatGPT API and external text sources. Every day ChatGPT generates the news headlines for the following day, by continuing the events of the current day.
It works the following way
- It fetches news headlines from the RSS feed of The Swedish television bureau, SVT.
- These headlines are used to generate a prompt for ChatGTP where future events will be predicted.
- ChatGPT responds with news headlines for tomorrow, from which a newsletter email is created.
- Lastly email subscribers are fetched from a google spreadsheet document, and are sent the newly created newspapper.
This is run as a CRON job 07:30 AM everyday.
You can sign up for the newsletter at news.lyresten.se.
Like everybody else I been thinking and tinkering a lot with ChatGPT, and I wanted to produce something tangible. One idea that I been thinking about for interesting integrations is having ChatGPT being the one contacting you. Hope you'll find this inspiring.
-
Install dependencies
npm ci
-
Rename
env.example
to.env
and enter the correct values for each field, only the API key for ChatGPT is neccessary for generating news stories - if you don't want to use this as an email service some minor modifications are neccessary. -
Test the service
node index.mjs test <your@email.address>
Enjoy ❤️ Lyret