Chat with News: Interact with your articles
Yuyi Kimura (YK46)
Posted on November 10, 2024
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.
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
-
pgvector
: I'm usingpgvector
to store the article embeddings that are generated throughllama3.2
model. -
pgai
: I usepgai
to callllama3.2
model through SQL queries to get related articles and generate an answer. -
pgai Vectorizer
: I set up a CLI command to run track changes on thearticles
table and vectorize all pending articles usingllama3.2
model. You can set up a cron job to run every X minutes, to have your articles embeddings always ready. See code here. -
Ollama
: I use Ollama to host thellama3.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.
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
Posted on November 10, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 11, 2024
November 10, 2024