Follow these steps:
- Start Docker and run docker compose (
docker compose up -d
) - Create the database and table (
postgre.sql
) - Insert the data (
insert.py
)- This will insert a list of random texts generated by ChatGPT, together with their embedding generated by the OpenAI API
- Query the data (
query.py
)- This will ask you for a prompt, generate the embedding for the question and then query the database using pg_vector search (L2 distance) and return the two closest texts