-
Notifications
You must be signed in to change notification settings - Fork 74
Closed
Description
Describe the bug
The pgvector index creates malformed queries.
To Reproduce
Steps to reproduce the behavior:
- Run postgresql with pgvector
- execute https://github.com/henomis/lingoose/blob/main/examples/embeddings/postgres/main.go
- A panic happens in the test with the error "internal index error: pq: syntax error at or near "<=>""
Expected behavior
The query works and outputs the purpose of Nato (as per the question)
Potential fix
It looks like the query parameters are swapped round. Simply changing them causes it to start working. In order to check it works with a non-empy filter also, the query was modified like so:
similarities, err := index.Query(
context.Background(),
query,
indexoption.WithTopK(3),
indexoption.WithFilter("where metadata->>'source' = 'state_of_the_union.txt'"),
)
This executed fine. Then updating the row with Nato in to be a difference source caused the down to be excluded, as expected
Metadata
Metadata
Assignees
Labels
No labels