mirror of
https://github.com/QuivrHQ/quivr.git
synced 2025-01-07 08:07:44 +03:00
ca93cb9062
# Description - Added package manager - Added precommit checks - Rewrote dependency injection of Services and Repositories - Integrate async SQL alchemy engine - Migrate Chat repository to SQLModel - Migrated ChatHistory repository to SQLModel - User SQLModel - Unit test methodology with db rollback - Unit tests ChatRepository - Test ChatService get_history - Brain entity SQL Model - Promp SQLModel - Rewrite chat/{chat_id}/question route - updated docker files and docker compose in dev and production Added `quivr_core` subpackages: - Refactored KnowledgebrainQa - Added Rag service to interface with non-rag dependencies --------- Co-authored-by: aminediro <aminediro@github.com>
26 lines
699 B
PL/PgSQL
26 lines
699 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$
|
|
;
|