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_KEYenvironment 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 mariadbTo calculate the vector embeddings for all the products in the database, run:
./ComputeVectors.javaTo run the chat demo, execute the following:
./ChatDemo.java