DEV Community

Yuyi Kimura (YK46)
Yuyi Kimura (YK46) Subscriber

Posted on

6 1 2 1 1

Chat with News: Interact with your articles

This is a submission for the Open Source AI Challenge with pgai and Ollama

What I Built

This application enables you to fetch, embed, and interact with news articles from RSS sources. The CLI tool allows you to set up RSS links, fetch and embed available articles, and expose an API for seamless interaction.

A simple web application was also developed to provide a more user-friendly experience. You can ask questions about articles published on specific dates, and Ollama LLM will respond while retrieving the related article for fact-checking or obtaining more details from the original source.

Setting up RSS feeds, fetching articles, and creating embeddings takes only minutes. With just a few CLI commands, you can have your article database ready in no time.

A set of CLI commands to build your articles-base

Demo

Website

https://chat-with-news.onrender.com
The project is set up to answer questions based on the news published on the selected date. This help improves the RAG by limiting the numbers of articles while also giving context more relevant to the question.

Source code

https://github.com/ypk46/chat-with-news

Tools Used

  1. pgvector: I'm using pgvector to store the article embeddings that are generated through llama3.2 model. Database diagram
  2. pgai: I use pgai to call llama3.2 model through SQL queries to get related articles and generate an answer. SQL queries using pgai
  3. pgai Vectorizer: I set up a CLI command to run track changes on the articles table and vectorize all pending articles using llama3.2 model. You can set up a cron job to run every X minutes, to have your articles embeddings always ready. See code here.
  4. Ollama: I use Ollama to host the llama3.2 which serves a couple purposes:
    • Generate an article's summary to display on the web.
    • Generate the embeddings from the article full content.
    • Generate answers to user's question related to any article on a given date.

Demo image of the web application

Final Thoughts

This demo helped me establish some solid groundwork for a personal project involving news aggregation and AI. I believe the tools developed by the Timescale team truly empower developers, making them more efficient and simplifying tedious tasks in a consistent and user-friendly way.

The pgai Vectorizer has been a game-changer for me. Keeping an embeddings store up to date can be repetitive and time-consuming. However, building a vectorizer worker is straightforward and highly effective for ensuring that your real data and embeddings store remain synchronized.

Prize Categories

This submission qualifies for:

  • Open-source Models from Ollama
  • Vectorizer Vibe
  • All the Extensions

Image of AssemblyAI

Automatic Speech Recognition with AssemblyAI

Experience near-human accuracy, low-latency performance, and advanced Speech AI capabilities with AssemblyAI's Speech-to-Text API. Sign up today and get $50 in API credit. No credit card required.

Try the API

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay