I’m using Supabase + pgvector inside my n8n workflow to store and search document embeddings.
Here’s what I did:
-
Created my table like this:
-
create table DNA_builder_questions ( id bigserial primary key, content text, -- corresponds to Document.pageContent metadata jsonb, -- corresponds to Document.metadata embedding vector(768) -- 1536 works for OpenAI embeddings, change if needed ); -- Create a function to search for documents create function match_UVP ( query_embedding vector(768), match_count int default null, filter jsonb DEFAULT '{}' ) returns table ( id bigint, content text, metadata jsonb, similarity float ) language plpgsql as $$ #variable_conflict use_column begin return query select id, content, metadata, 1 - (documents.embedding <=> query_embedding) as similarity from documents where metadata @> filter order by documents.embedding <=> query_embedding limit match_count; end; $$;
- I inserted embeddings that are 768 dimensions (from the model I’m currently using).
- Insert works fine, data is stored correctly.
- But when I run a search using the
match_documentsfunction, I get this error:
“Error searching for documents: 22000 different vector dimensions 1536 and 768”
It seems my table expects 1536 dimensions, but my vectors are 768.
Has anyone here experienced the same mismatch problem? Would love to hear how you have handled this!
Thanks ![]()
