Skip to content
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

PGVector integration #3351

Open
BjornMoren opened this issue Dec 12, 2024 · 0 comments
Open

PGVector integration #3351

BjornMoren opened this issue Dec 12, 2024 · 0 comments

Comments

@BjornMoren
Copy link

It would be nice to be able to send an embedding vector directly to PostgreSQL without having to serialize it into a string first.

// Example with Transformers.js library and PGVector extension
const transformers = await import('@xenova/transformers');
const similarityEmbedder = await transformers.pipeline('feature-extraction', 'Xenova/paraphrase-MiniLM-L6-v2');
const result = await similarityEmbedder(text, { pooling: 'mean', normalize: true });

const embedding = '[' + [...result.data].join(',') + ']';   // Please get rid of this step so we can send the Float32Array directly 

await client.query(
   `INSERT INTO post_embedding (post_id, embedding) 
   VALUES ($1, $2)`,
   [postID, embedding]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants