The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: openai-pgvector embedding example function
nathan0699a74dc3e5
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 46001ec1f17..5a689d9de29 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@@ -104,7 +104,7 @@ Soon we're going to need to perform a similarity search over these embeddings. L```sqlcreate or replace function match_documents (query_embedding vector(1536),- similarity_threshold float,+ match_threshold float,match_count int)returns table (@@ -117,12 +117,12 @@ as $$beginreturn queryselect- id,- content,+ documents.id,+ documents.content,1 - (documents.embedding <=> query_embedding) as similarityfrom documents- where 1 - (documents.embedding <=> query_embedding) > similarity_threshold- order by documents.embedding <=> query_embedding+ where 1 - (documents.embedding <=> query_embedding) > match_threshold+ order by similarity desclimit match_count;end;$$;