postgresml / postgresml

The GPU-powered AI application database. Get your app to market faster using the simplicity of SQL and the latest NLP, ML + LLM models.

Home Page:https://postgresml.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wrong SQL SELECT in readme

remote4me opened this issue · comments

Environment: Ubuntu 22.04, Self-hosted Postgresml installed in Postgresql 13 database

I am following instructions here (under "Vector Database", "Step 3: Querying the index using embeddings for your queries"):
https://github.com/postgresml/postgresml?tab=readme-ov-file#vector-database

This SQL does not works:

WITH query AS (
    SELECT pgml.embed('distilbert-base-uncased', 'Star Wars christmas special is on Disney')::vector AS embedding
)
SELECT * FROM items, query ORDER BY items.embedding <-> query.embedding LIMIT 5;

Error message:

ERROR: relation "items" does not exist
  Position: 152

SELECT * FROM items, query ORDER BY items.embedding <-> query.embedding LIMIT 5
              ^
1 statement failed.

But this SQL works (without index - index creation failed, this is another issue):

WITH query AS (
    SELECT pgml.embed('distilbert-base-uncased', 'Star Wars christmas special is on Disney')::vector AS embedding
)
SELECT * FROM public.tweet_embeddings, query 
ORDER BY 
  public.tweet_embeddings.embedding::vector <-> query.embedding 
LIMIT 5;