This application serves as my introduction to programming with AI, focusing on implementing Retrieval Augmented Generation (RAG) using a Redis datasource. It allows the user to import spending data via CSV files and allows the user to ask questions about the data that was imported.
- Import spending records via a CSV and import into Redis Vector DB
- Use AI to answer questions based on the data set after pulling RAG data from redis.
CSV files can be imported using the following CSV format:
name,description,date,category,amount
Groceries,Weekly food shopping at Superstore,2025-04-15,Debit,75.23
Coffee,Morning latte from local cafe,2025-04-16,Credit,5.50Each row of the CSV is processed, and is stored as a redis document along with an embedding that will be used by AI to determine potential matching records using a vector search. The 'sentence-transformers/all-MiniLM-L6-v2' model is used to create the embedding for each row.
When a question is asked about the model, an embedding is created based on the question, and a vector query is made to the redis datastore and retrieves the documents that are closely related.
To answer the question about the matching data, a text generating AI model is used to analyse the data from the query to provide an answer.
When asking a question to the model, a prompt is created for the particular model and the data from query result is formatted into a table structure and is included as the 'context' used to answer the question.
This application only 'sort of works'. The results it produces are never really accurate and based on the questions asked, it often can't produce a reliable answer, if at all. This likely has a lot to with my current knowledge lever of the technology and the models that I've opted to use.
As this was my introduction to AI, I found that there was an incredible learning curve when it comes to the technology and achieving accurate results was difficult. Implementing a basic chatbot is pretty straightforward (which I played with outside of this project) using the tools available, however, building something to solve an isolated problem requires using larger and more fine-tuned models.
This project served as a good introduction the world of AI programming. I'll continue to try and improve this project and evolve it into something that is actually useful.
$ cd redis-stack
$ podman compose up -d$ python -m venv .venv
$ . .venv/bin/activate
$ pip install --upgrade pip
$ pip install click transformers redisvl langchain_community sentence_transformers pylatexenc pandas accelerateThe 'budgie' application is a CLI based app.
$ $ src/budgie --help
Usage: budgie [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
ask
import-file$ src/budgie import-file data/spending.csv $ src/budgie ask --help
Usage: budgie ask [OPTIONS] QUESTION
Options:
--model TEXT The name of the model to use: ['tiny-llama', 'qwen', 'tapas']
--help Show this message and exit.
$ src/budgie ask "How many Debit transactions were made on 2025-05-05?"