mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-15 01:21:48 +03:00
d0b8b797f6
Co-authored-by: Zewed <dewez.antoine2@gmail.com> Co-authored-by: Antoine Dewez <44063631+Zewed@users.noreply.github.com>
28 lines
701 B
PL/PgSQL
28 lines
701 B
PL/PgSQL
alter table "public"."brains" add column "meaning" vector;
|
|
|
|
alter table "public"."brains" alter column "description" set default 'This needs to be changed'::text;
|
|
|
|
alter table "public"."brains" alter column "description" set not null;
|
|
|
|
set check_function_bodies = off;
|
|
|
|
CREATE OR REPLACE FUNCTION public.match_brain(query_embedding vector, match_count integer)
|
|
RETURNS TABLE(id uuid, name text, similarity double precision)
|
|
LANGUAGE plpgsql
|
|
AS $function$
|
|
#variable_conflict use_column
|
|
begin
|
|
return query
|
|
select
|
|
brain_id,
|
|
name,
|
|
1 - (brains.meaning <=> query_embedding) as similarity
|
|
from brains
|
|
order by brains.meaning <=> query_embedding
|
|
limit match_count;
|
|
end;
|
|
$function$
|
|
;
|
|
|
|
|