[eng 1944] Ensure/test pgvector compatibility#22
Conversation
There was a problem hiding this comment.
Pull Request Overview
Adds pgvector support to the library and updates tests to verify vector-based search works under Oso authorization.
- Introduces an optional
embeddingfield onDocumentbacked bypgvector - Updates test setup to use a
pgvector-enabled Postgres image and create the extension - Adds numerous tests exercising L2, cosine, and inner-product searches via both ORM and Core APIs
Comments suppressed due to low confidence (1)
vrama628
left a comment
There was a problem hiding this comment.
nice! Left a few non-blocking comments about whether certain things are necessary
| pgvector = "^0.4.1" | ||
| numpy = [ | ||
| { version = ">=1.21.0,<2.0", python = "<3.10" }, | ||
| { version = ">=2.1.0", python = ">=3.10" }, |
There was a problem hiding this comment.
what's the purpose of specifying 2.1.0 for >=3.10?
There was a problem hiding this comment.
This is to ensure compatibility with our lowest accepted python version (3.9) and the latest python version (3.13.5). I ran python on both of these versions while testing. Essentially:
- pgvector requires numpy
- Numpy drops support for 3.9 at
2.1.0 - the highest version of numpy that supports 3.9,
2.0.1supports up to 3.12, so not 3.13+ :( - any Python users at 3.13+ would have to use a more recent numpy version.
I thought we might as well use 2.1+ for 3.10, and I carved out this earlier version of numpy for applications python 3.9.
I'll test manually, but I'll see if i can up the version of the python 3.9 version of numpy to 2.0.1:
numpy = [
{ version = ">=1.21.0,<2.1.0", python = "<3.10" },
{ version = ">=2.1.0", python = ">=3.10" },
]
Changes:
Some things for separate tickets:
l2_distance) are greyed out // return "Any"