mirror of
https://github.com/StanGirard/quivr.git
synced 2024-11-30 21:28:56 +03:00
docs(updated): new scripts
This commit is contained in:
parent
4934f46121
commit
583e4d6378
@ -109,6 +109,10 @@ cp .frontend_env.example frontend/.env
|
|||||||
|
|
||||||
[Migrations Script 4](scripts/supabase_users_table.sql)
|
[Migrations Script 4](scripts/supabase_users_table.sql)
|
||||||
|
|
||||||
|
[Migration Script 5](scripts/supabase_chats_table.sql)
|
||||||
|
|
||||||
|
[Migration Script 6](supabase/migrations/20230606131110_add_uuid_user_id.sql)
|
||||||
|
|
||||||
- **Step 5**: Launch the app
|
- **Step 5**: Launch the app
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
create extension vector;
|
|
||||||
|
|
||||||
-- Create a table to store your documents
|
|
||||||
create table if not exists documents (
|
|
||||||
id bigserial primary key,
|
|
||||||
content text, -- corresponds to Document.pageContent
|
|
||||||
metadata jsonb, -- corresponds to Document.metadata
|
|
||||||
embedding vector(1536) -- 1536 works for OpenAI embeddings, change if needed
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE FUNCTION match_documents(query_embedding vector(1536), match_count int)
|
|
||||||
RETURNS TABLE(
|
|
||||||
id bigint,
|
|
||||||
content text,
|
|
||||||
metadata jsonb,
|
|
||||||
-- we return matched vectors to enable maximal marginal relevance searches
|
|
||||||
embedding vector(1536),
|
|
||||||
similarity float)
|
|
||||||
LANGUAGE plpgsql
|
|
||||||
AS $$
|
|
||||||
# variable_conflict use_column
|
|
||||||
BEGIN
|
|
||||||
RETURN query
|
|
||||||
SELECT
|
|
||||||
id,
|
|
||||||
content,
|
|
||||||
metadata,
|
|
||||||
embedding,
|
|
||||||
1 -(documents.embedding <=> query_embedding) AS similarity
|
|
||||||
FROM
|
|
||||||
documents
|
|
||||||
ORDER BY
|
|
||||||
documents.embedding <=> query_embedding
|
|
||||||
LIMIT match_count;
|
|
||||||
END;
|
|
||||||
$$;
|
|
Loading…
Reference in New Issue
Block a user