Bjorn Moren
Bjorn Moren
Sounds great brianc. Will the below work for you? The embedding column below is of type Vector. ``` // const transformers = await import('@xenova/transformers'); // const similarityEmbedder = await transformers.pipeline('feature-extraction',...
No those lines are commented out. ``` const embedding = new Float32Array(384).map(() => Math.random() * 0.4 - 0.2); await client.query( `INSERT INTO post_embedding (post_id, embedding) VALUES ($1, $2)`, [postID, embedding]);...
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; ```
Sorry, I should have mentioned that your PG installation must have the PGVector extension installed, or the column type "vector" is not defined. https://github.com/pgvector/pgvector
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...