ERROR: 42704: type "extensions.vector" does not exist
ERROR: 42704: type "extensions.vector" does not exist
LINE 9: embedding extensions.vector(1536) -- 1536 works for OpenAI embeddings, change if needed
====================
I got an error msg as above when I start a new project and run the following SQL code from Supabase doc (https://supabase.com/docs/guides/ai/langchain?database-method=sql)
Do you have any suggestions? THX.
=====================
-- Enable the pgvector extension to work with embedding vectors
create extension vector;
-- Create a table to store your documents
create table documents (
id bigserial primary key,
content text, -- corresponds to Document.pageContent
metadata jsonb, -- corresponds to Document.metadata
embedding extensions.vector(1536) -- 1536 works for OpenAI embeddings, change if needed
);
-- Create a function to search for documents
create function match_documents (
query_embedding extensions.vector(1536),
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;
$$;
LINE 9: embedding extensions.vector(1536) -- 1536 works for OpenAI embeddings, change if needed
====================
I got an error msg as above when I start a new project and run the following SQL code from Supabase doc (https://supabase.com/docs/guides/ai/langchain?database-method=sql)
Do you have any suggestions? THX.
=====================
-- Enable the pgvector extension to work with embedding vectors
create extension vector;
-- Create a table to store your documents
create table documents (
id bigserial primary key,
content text, -- corresponds to Document.pageContent
metadata jsonb, -- corresponds to Document.metadata
embedding extensions.vector(1536) -- 1536 works for OpenAI embeddings, change if needed
);
-- Create a function to search for documents
create function match_documents (
query_embedding extensions.vector(1536),
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;
$$;
Learn how to integrate Supabase with LangChain, a popular framework for composing AI, Vectors, and embeddings