examples/ai/edge-functions/README.md
Since Supabase Edge Runtime v1.36.0 you can run the gte-small model natively within Supabase Edge Functions without any external dependencies! This allows you to easily generate text embeddings without calling any external APIs!
This demo consists of three parts:
generate-embedding database webhook edge function which generates embeddings when a content row is added (or updated) in the public.embeddings table.query_embeddings Postgres function which allows us to perform similarity search from an egde function via Remote Procedure Call (RPC).search edge function which generates the embedding for the search term, performs the similarity search via RPC function call, and returns the result.supabase linksupabase functions deploysupabase config pushgenerate-embedding function details.supabase db pushRun a search via curl POST request:
curl -i --location --request POST 'https://<PROJECT-REF>.supabase.co/functions/v1/search' \
--header 'Authorization: Bearer <SUPABASE_ANON_KEY>' \
--header 'Content-Type: application/json' \
--data '{"search":"vehicles"}'