-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
PGVector integration #3351
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
Comments
I would like to see this feature as well |
definitely happy to work on this! if you can submit a self-contained snippet of code that works w/o needing to call any 3rd party APIs I can probably whip this out extremely quickly. |
Sounds great brianc. Will the below work for you? The embedding column below is of type Vector.
|
preferrably something I don't need to |
No those lines are commented out.
|
ohhh nice - i see i see. what about the create temp table statement for the query? Would be useful to know the types of the columns. The idea is this needs to run in CI - so the more greased we can make the rails for me to dig into it the easier I can turn it around. |
All good?
|
aye ty - i'll take a look at this soon!
…On Thu, Feb 27, 2025 at 6:48 PM Bjorn Moren ***@***.***> wrote:
All good?
CREATE TABLE IF NOT EXISTS public.post_embedding
(
post_id integer NOT NULL,
embedding vector(384) NOT NULL
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.post_embedding
OWNER to postgres;
—
Reply to this email directly, view it on GitHub
<#3351 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAMHIJ6RXVJXUXEFNNE46T2R6B3JAVCNFSM6AAAAABTPBQPYSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMOBZGE4DGOBTGY>
.
You are receiving this because you commented.Message ID:
***@***.***>
[image: BjornMoren]*BjornMoren* left a comment (brianc/node-postgres#3351)
<#3351 (comment)>
All good?
CREATE TABLE IF NOT EXISTS public.post_embedding
(
post_id integer NOT NULL,
embedding vector(384) NOT NULL
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.post_embedding
OWNER to postgres;
—
Reply to this email directly, view it on GitHub
<#3351 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAMHIJ6RXVJXUXEFNNE46T2R6B3JAVCNFSM6AAAAABTPBQPYSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMOBZGE4DGOBTGY>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Sorry, I should have mentioned that your PG installation must have the PGVector extension installed, or the column type "vector" is not defined. |
hmmm this is not straightforward & I'm not sure there's a backwards compatible way to do this actually. I just tried but it doesn't work because node-postgres already automatically converts ArrayBuffers (and typed arrays) to be compatible with the |
I can't get that to work unfortunately. What my example above shows is a standard operation with LLMs (Large Language Models), which are becoming very popular due to the explosion of AI. They process large amounts of data. In this case a vector of 384 dimensions, but other more popular models have 2000 or even more dimensions. So this kind of stuff is coming more and more and requires an efficient way to do this. On the other hand, when high performance is needed then normally you move away from doing these operations in Node and instead install a proper LLM server. I guess it is your call if this is something you think your PG library should have. |
It would be nice to be able to send an embedding vector directly to PostgreSQL without having to serialize it into a string first.
The text was updated successfully, but these errors were encountered: