Quicknews

Quicknews

I continue my shenanigans with GPT3. After FRIDAI, I started working on a service that summarizes news. The idea for the service came from an e-mail summarizing feature created by Justin Alvey. Once I saw his demo, I knew I would need something like this but for news from my RSS feed.

I started the project by exporting my RSS feed to Feedly. I did this because Feedly offers free API. I use it to fetch the news from the last N hours. When I get the response from Feedly, I filter out the data: URL to the article, the id, the publisher's name, and the URL to the thumbnail image. To summarize the article, I only need the article's URL. I extract the rest of the fields to return more context about the news to potential 3rd-party clients.

Once I have the information from Feedly, I build the prompt that I later send to ChatGPT. This prompt asks the language model to read the articles from provided URLs and summarize them in 1-3 sentences.

I also ask to merge similar news/articles into one summary, but it should group the links to related articles with the summary. In response, it should return a JSON object. This object has a list of generated summaries grouped with source URLs. The answer from ChatGPT looks something like this:

{
  "summaries": [
    {
      "summary": "According to sources, Microsoft's acquisition of Activision Blizzard is likely to win approval from the European Union. The deal, which is worth $68.7 billion, has already received regulatory approval in the US and several other countries.",
      "links": [
        "https://arstechnica.com/tech-policy/2023/03/microsoft-activision-deal-will-win-eu-approval-sources-say/"
      ]
    },
    {
      "summary": "Meta (formerly Facebook) is cutting prices for its Quest virtual reality headset by up to 20%, starting immediately. The move is seen as a response to competition from other companies in the VR space, such as Sony and HTC.",
      "links": [
        "https://9to5mac.com/2023/03/03/meta-slashing-quest-headset-prices/"
      ]
    },
    {
      "summary": "A security researcher has discovered an exploit in the Wii U version of Mario Kart 8 and Splatoon that allows players to run homebrew software on their consoles. Nintendo has not yet released a patch for the vulnerability.",
      "links": [
        "https://www.theverge.com/2023/3/3/23623618/nintendo-wii-u-mario-kart-8-splatoon-offline-vulnerability-exploit"
      ]
    },
    {
      "summary": "A new trailer for the Pokemon Scarlet and Violet anime series has been released. The show is set in the Galar region, which was first introduced in the Pokemon Sword and Shield video games.",
      "links": [
        "https://www.theverge.com/2023/3/3/23623659/pokemon-scarlet-violet-anime-trailer"
      ]
    }
  ]
}

When ChatGPT returns the response, I combine the received summaries with the publisher's name and thumbnail URL I received earlier from Feedly. Then I return JSON with all those data:

{
  "summaries": [
    {
      "summary": "According to sources, Microsoft's acquisition of Activision Blizzard is likely to win approval from the European Union. The deal, which is worth $68.7 billion, has already received regulatory approval in the US and several other countries.",
      "links": [
        "https://arstechnica.com/tech-policy/2023/03/microsoft-activision-deal-will-win-eu-approval-sources-say/"
      ],
      "publisher": "Ars Technica - All content",
      "thumbnail": null
    },
    {
      "summary": "Meta (formerly Facebook) is cutting prices for its Quest virtual reality headset by up to 20%, starting immediately. The move is seen as a response to competition from other companies in the VR space, such as Sony and HTC.",
      "links": [
        "https://9to5mac.com/2023/03/03/meta-slashing-quest-headset-prices/"
      ],
      "publisher": "9to5Mac",
      "thumbnail": null
    },
    {
      "summary": "A security researcher has discovered an exploit in the Wii U version of Mario Kart 8 and Splatoon that allows players to run homebrew software on their consoles. Nintendo has not yet released a patch for the vulnerability.",
      "links": [
        "https://www.theverge.com/2023/3/3/23623618/nintendo-wii-u-mario-kart-8-splatoon-offline-vulnerability-exploit"
      ],
      "publisher": "The Verge",
      "thumbnail": null
    },
    {
      "summary": "A new trailer for the Pokemon Scarlet and Violet anime series has been released. The show is set in the Galar region, which was first introduced in the Pokemon Sword and Shield video games.",
      "links": [
        "https://www.theverge.com/2023/3/3/23623659/pokemon-scarlet-violet-anime-trailer"
      ],
      "publisher": "The Verge",
      "thumbnail": null
    }
  ]
}

I wrapped all of this logic with the Express server. This server has two endpoints. The first one passes through the JSON object I mentioned before. Although I have this endpoint, I don't use it for now because I focused on the second endpoint. This one takes the summaries and combines them into one long string.

Then I created a Siri shortcut that calls the second endpoint on my server. Once it receives the response, I ask Siri to spell out the summaries:

With everything put together it works something like this:


Comments

Anything interesting to share? Write a comment.