Skip to content

jirihofman/sentiment-guardian

Repository files navigation

The Sentiment of The Guardian

This app periodically loads headlines from The Guardian and evaluates their sentiment using OpenAI's GPT-4 model.

It used to use GPT-3.5-turbo model but its results were not ideal. GPT-4 performs much better even though it is a bit pricier. To compensate for that we don't send article description anymore.

Since 2023-11-30 gpt-4-1106-preview is used to save some bucks.

Nextjs app template

Based on jirihofman/nextjs-fullstack-app-template.

codecov

TODO

  • make a page visually similar to The Guardian headline section and add sentiment emojis to it?

Dev notes, debug

@upstash/redis

# Set initial categories for existing articles
set category:guardian:NEG1 8
set category:guardian:NEG2 5
set category:guardian:NEU 6
set category:guardian:POS1 1
set category:guardian:NEU 0

Manually populating the DB

curl -XPOST https://sentiment-guardian.vercel.app/api/articles -d '{"adminApiKey":"ADMIN_API_KEY"}'
curl -XPOST https://sentiment-guardian.vercel.app/api/sentiment -d '{"adminApiKey":"ADMIN_API_KEY"}'

About

📰 Using OpenAI's GPT-4 to determine sentiment of The Guardian's headlines. Rise and shine or doom and gloom?

Topics

Resources

Stars

Watchers

Forks

Languages