Skip to content

Commit

Permalink
doc: modify the docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
guangzhengli committed Jul 10, 2023
1 parent 6e7f521 commit 9adae3a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 124 deletions.
88 changes: 0 additions & 88 deletions doc/Example.md

This file was deleted.

Binary file removed doc/chatfiles.png
Binary file not shown.
40 changes: 4 additions & 36 deletions doc/vectordb/supabase.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,16 @@ https://supabase.com

## Create a new project

get the url and service role key.
get the database url

## Create a new table
Run this in your database:

```sql
-- 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 vector(1536) -- 1536 works for OpenAI embeddings, change if needed
);

-- Create a function to search for documents
create function match_documents (
query_embedding 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;
$$;
```shell
npx prism migrate dev
```

0 comments on commit 9adae3a

Please sign in to comment.