Rest API that implements RAG on the datasource linked to the Sakila database. The Sakila database models the DVD rental store business, which contains content such as films, actors, inventory, stores, customers and staffs.
To navigate Sakila's SQL schema.
The API lets you query the Sakila database using natural language.
- Install Ollama on your computer : To run an LLM model locally
- Run llama3
- Have docker installed on your computer : For devservices based on Testcontainers
- Start Application
./mvnw quarkus:dev
- Open Swagger UI on the URL http://localhost:8080/q/swagger-ui/
ℹ️ The
scripts/run-sql.sh
script is used to check API responses.Usage :
scripts/run-sql.sh "<SQL QUERY>"
Example of SQL queries to insert into Swagger UI :
- Which actors have the first name Scarlett ?
scripts/run-sql.sh "select * from actor where first_name = 'Scarlett'"
- Which actor has appeared in the most films ?
scripts/run-sql.sh "select actor.actor_id, actor.first_name, actor.last_name,
count(actor_id) as film_count
from actor join film_actor using (actor_id)
group by actor_id
order by film_count desc
limit 1"
- What is the average length of films by category ?
scripts/run-sql.sh "select category.name, avg(length)
from film join film_category using (film_id) join category using (category_id)
group by category.name
order by avg(length) desc"
- Which actors have the last name BALL ?
scripts/run-sql.sh "select * from actor where last_name like 'BALL'"