The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
run formatting
Francesco Sansalvadorea1e880de7603
diff --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 c74c8e992e6..4a7ba2d3293 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@@ -11,9 +11,9 @@ date: '2023-02-06'toc_depth: 3----A new PostgreSQL extension is now available in Supabase: [`pgvector`]([https://github.com/pgvector/pgvector](https://supabase.com/docs/guides/getting-started/openai/vector-search)), an open-source vector similarity search.+A new PostgreSQL extension is now available in Supabase: [`pgvector`](<[https://github.com/pgvector/pgvector](https://supabase.com/docs/guides/getting-started/openai/vector-search)>), an open-source vector similarity search.-The exponential progress of AI functionality over the past year has inspired many new real world applications. One specific challenge has been the ability to store and query _embeddings_ at scale.+The exponential progress of AI functionality over the past year has inspired many new real world applications. One specific challenge has been the ability to store and query _embeddings_ at scale.In this post we'll explain what embeddings are, why we might want to use them, and how we can store and query them in PostgreSQL using `pgvector`.## What are embeddings?@@ -88,11 +88,12 @@ create extension vector;Next let's create a table to store our documents and their embeddings:```sql-create table documents (- id bigserial primary key,- content text,- embedding vector (1536)-);+create table+ documents (+ id bigserial primary key,+ content text,+ embedding vector (1536)+ );````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.@@ -147,9 +148,9 @@ 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):```sql-create index on documents-using ivfflat (embedding vector_cosine_ops)-with (lists = 100);+create index on documents using ivfflat (embedding vector_cosine_ops)+with+ (lists = 100);```You can read more about indexing on `pgvector`'s GitHub page [here](https://github.com/pgvector/pgvector#indexing).diff --git a/apps/www/public/planetpg-oli_rice-rss.xml b/apps/www/public/planetpg-oli_rice-rss.xmlindex 19ac784cc0c..4c5732d83e0 100644--- a/apps/www/public/planetpg-oli_rice-rss.xml+++ b/apps/www/public/planetpg-oli_rice-rss.xml@@ -5,9 +5,16 @@<link>https://supabase.com/blog</link><description>Latest Postgres news from Oliver Rice at Supabase</description><language>en</language>- <lastBuildDate>Thu, 16 Feb 2023 23:11:00 +0000</lastBuildDate>+ <lastBuildDate>Thu, 20 Apr 2023 22:10:00 +0000</lastBuildDate><atom:link href="https://supabase.com/planetpg-oli_rice-rss.xml" rel="self" type="application/rss+xml"/><item>+ <guid>https://supabase.com/blog/whats-new-in-pg-graphql-v1-2</guid>+ <title>What's New in pg_graphql v1.2</title>+ <link>https://supabase.com/blog/whats-new-in-pg-graphql-v1-2</link>+ <description>New Features in the v1.2 release of pg_graphql</description>+ <pubDate>Thu, 20 Apr 2023 22:10:00 +0000</pubDate>+</item>+<item><guid>https://supabase.com/blog/type-constraints-in-65-lines-of-sql</guid><title>Type Constraints in 65 lines of SQL</title><link>https://supabase.com/blog/type-constraints-in-65-lines-of-sql</link>diff --git a/apps/www/public/rss.xml b/apps/www/public/rss.xmlindex ed2bb354633..87da5fb07f6 100644--- a/apps/www/public/rss.xml+++ b/apps/www/public/rss.xml@@ -5,9 +5,37 @@<link>https://supabase.com</link><description>Latest news from Supabase</description><language>en</language>- <lastBuildDate>Thu, 13 Apr 2023 22:10:00 +0000</lastBuildDate>+ <lastBuildDate>Sun, 14 May 2023 22:10:00 +0000</lastBuildDate><atom:link href="https://supabase.com/rss.xml" rel="self" type="application/rss+xml"/><item>+ <guid>https://supabase.com/blog/building-chatgpt-plugins-template</guid>+ <title>Building ChatGPT Plugins with Supabase Edge Runtime</title>+ <link>https://supabase.com/blog/building-chatgpt-plugins-template</link>+ <description>undefined</description>+ <pubDate>Sun, 14 May 2023 22:10:00 +0000</pubDate>+</item>+<item>+ <guid>https://supabase.com/blog/postgres-pluggable-strorage</guid>+ <title>Next steps for Postgres pluggable storage</title>+ <link>https://supabase.com/blog/postgres-pluggable-strorage</link>+ <description>Exploring history of Postgres pluggable storage and the possibility of landing it in the Postgres core.</description>+ <pubDate>Thu, 27 Apr 2023 22:10:00 +0000</pubDate>+</item>+<item>+ <guid>https://supabase.com/blog/launch-week-7-hackathon-winners</guid>+ <title>Launch Week 7 Hackathon Winners</title>+ <link>https://supabase.com/blog/launch-week-7-hackathon-winners</link>+ <description>Announcing the winners of the Launch Week 7 Hackathon!</description>+ <pubDate>Sun, 23 Apr 2023 22:10:00 +0000</pubDate>+</item>+<item>+ <guid>https://supabase.com/blog/whats-new-in-pg-graphql-v1-2</guid>+ <title>What's New in pg_graphql v1.2</title>+ <link>https://supabase.com/blog/whats-new-in-pg-graphql-v1-2</link>+ <description>New Features in the v1.2 release of pg_graphql</description>+ <pubDate>Thu, 20 Apr 2023 22:10:00 +0000</pubDate>+</item>+<item><guid>https://supabase.com/blog/supabase-studio-2.0</guid><title>Supabase Studio 2.0: help when you need it most</title><link>https://supabase.com/blog/supabase-studio-2.0</link>@@ -620,7 +648,7 @@<guid>https://supabase.com/blog/graphql-now-available</guid><title>GraphQL is now available in Supabase</title><link>https://supabase.com/blog/graphql-now-available</link>- <description>GraphQL support is now in general availability on the Supabase platform via our open source PostgreSQL extension, pg_graphql (beta).</description>+ <description>GraphQL support is now in general availability on the Supabase platform via our open source PostgreSQL extension, pg_graphql.</description><pubDate>Mon, 28 Mar 2022 22:10:00 +0000</pubDate></item><item>