-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: postgresql store #157
base: main
Are you sure you want to change the base?
Conversation
Thanks for your contribution, nearly done with my review but I'll go ahead and approve and run the workflow. |
Hey great work, any update on this? |
I'm still in my review, I got wrapped up in some other responsibilities, will get it out ASAP! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the delay on this review! Mostly looking good, a couple of changes I've requested here.
One note: I noticed that 'static
was used a good bit here which was likely inherited from the sqlite
implementation. I think this is due to how the connection requires an closure with an async block which makes borrowing and using such things really odd.
Recently, proper async closures which will get into Rust stable sometime in 2025 which should help us alleviate our usage of 'static
here (i think!)
Thanks for the review. I'm still in holiday mode until New Year's, will address the comments on Jan 2 or 3. |
Hey @0xMochan ready for another round. I've addressed the comments you brought up, optimistically resolved the ones I think are done, but feel free to reopen if you think otherwise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, I've tested locally and it works fine for me. Thanks for this PR, will be included in the next release!
CI / CD will be fixed soon, I'll rerun and then we'll merge to main afterwards.
|
||
## PostgreSQL usage | ||
|
||
The crate utilizes the [pgvector](https://github.com/pgvector/pgvector) extension, which is available for PostgreSQL version 13 and later. Use any of the [official](https://www.postgresql.org/download/) or alternative methods to install psql. The `pgvector` extension will be automatically installed by the crate if it's not present yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my testing, I had to go an add the pgvector
extension myself. Not sure if I did something wrong, I had installed postgres
via brew
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, curious. You mean by brew installing it separately or something like that?
In any case, I guess the confusing term here in the README is "installed" - what I meant is that the crate will run CREATE EXTENSION
which is the installation of the extension into the database, but of course there's also the installation of the extension library itself into the computer.
Resolves #5
I've modeled the crate on the SQLite one.
On the DB side, the crate is relying on the pgvector extension. It creates an HSNW index and uses the cosine distane operator to compare embeddings.
Please let me know it this looks ok or if there are any parts of the code that should be changed.