Spaces:
Sleeping
Sleeping
File size: 475 Bytes
a6dbfdf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
create or replace function match_documents_langchain(
query_embedding vector(768),
match_count int default 5
)
returns table (
id uuid,
content text,
metadata json,
similarity float
)
language plpgsql
as $$
begin
return query
select
documents.id,
documents.content,
documents.metadata,
1 - (documents.embedding <=> query_embedding) as similarity
from documents
order by documents.embedding <=> query_embedding
limit match_count;
end;
$$; |