Skip to content

mariadb-developers/mariadb-rag-demo-java

 
 

Repository files navigation

Demo: RAG with MariaDB (Java)

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).

Prerequisites

Setup

  1. Set the OPENAI_API_KEY environment variable to your OpenAI API key. For example (Linux/MacOS):
export OPENAI_API_KEY=sk-example1234567890abcdef1234567890abcdef
  1. Start MariaDB (see the docker-compose.yml file):
docker compose up -d
  1. Check that MariaDB started successfully:
docker logs mariadb

Calculate the vector embeddings

To calculate the vector embeddings for all the products in the database, run:

./ComputeVectors.java

Run the chat demo

To run the chat demo, execute the following:

./ChatDemo.java

About

Retrieval-Augmented Generation (RAG) with MariaDB vector search and OpenAI API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PowerShell 32.3%
  • Shell 29.7%
  • Java 24.9%
  • Batchfile 13.1%