This demo shows how to build a Retrieval-Augmented Generation (RAG) application using MariaDB, OpenAI API, and Java (with no AI frameworks for learning purposes).
- Set the
OPENAI_API_KEY
environment variable to your OpenAI API key. For example (Linux/MacOS):
export OPENAI_API_KEY=sk-example1234567890abcdef1234567890abcdef
- Start MariaDB (see the docker-compose.yml file):
docker compose up -d
- Check that MariaDB started successfully:
docker logs mariadb
To calculate the vector embeddings for all the products in the database, run:
./ComputeVectors.java
To run the chat demo, execute the following:
./ChatDemo.java