The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
ignore mdx
Copple90a52c4abf20
diff --git a/.prettierignore b/.prettierignoreindex 9ab0849d504..db287264935 100644--- a/.prettierignore+++ b/.prettierignore@@ -3,4 +3,5 @@node_modulespackage-lock.jsondocker*-apps/**/out\ No newline at end of file+apps/**/out+**/**.mdx\ No newline at end of filediff --git a/apps/www/_blog/2023-02-03-openai-embeddings-postgres-vector.mdx b/apps/www/_blog/2023-02-03-openai-embeddings-postgres-vector.mdxindex d783d0caa32..e3f25f76252 100644--- a/apps/www/_blog/2023-02-03-openai-embeddings-postgres-vector.mdx+++ b/apps/www/_blog/2023-02-03-openai-embeddings-postgres-vector.mdx@@ -86,7 +86,6 @@ create extension vector;Next let's create a table to store our documents and their embeddings:-<!-- prettier-ignore-start -->```sqlcreate table documents (id bigserial primary key,@@ -94,7 +93,6 @@ create table documents (embedding vector (1536));```-<!-- prettier-ignore-end -->`pgvector` introduces a new data type called `vector`. In the code above, we create a column named `embedding` with the `vector` data type. The size of the vector defines how many dimensions the vector holds. OpenAI's `text-embedding-ada-002` model outputs 1536 dimensions, so we will use that for our vector size.@@ -102,7 +100,6 @@ We also create a `text` column named `content` to store the original document teSoon we're going to need to perform a similarity search over these embeddings. Let's create a function to do that:-<!-- prettier-ignore-start -->```sqlcreate or replace function match_documents (query_embedding vector(1536),@@ -129,7 +126,6 @@ beginend;$$;```-<!-- prettier-ignore-end -->`pgvector` introduces 3 new operators that can be used to calculate similarity:@@ -149,13 +145,11 @@ Once your table starts to grow with embeddings, you will likely want to add an iEach distance operator requires a different type of index. We expect to order by cosine distance, so we need `vector_cosine_ops` index. A good starting number of lists is 4 \* sqrt(table_rows):-<!-- prettier-ignore-start -->```sqlcreate index on documentsusing ivfflat (embedding vector_cosine_ops)with (lists = 100);```-<!-- prettier-ignore-end -->You can read more about indexing on `pgvector`'s GitHub page [here](https://github.com/pgvector/pgvector#indexing).