The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Adds a few more quickstarts with Colab links
Copple21d835e2ddd2
diff --git a/apps/docs/components/MDX/database_setup.mdx b/apps/docs/components/MDX/database_setup.mdxnew file mode 100644index 00000000000..2a6e853f9c2--- /dev/null+++ b/apps/docs/components/MDX/database_setup.mdx@@ -0,0 +1,18 @@+import { Tabs } from 'ui'+export const TabPanel = Tabs.Panel++## Project setup++Let's create a new Postgres database. This is as simple as starting a new Project in Supabase:++1. [Create a new project](https://database.new/) in the Supabase dashboard.+1. Enter your project details. Remember to store your password somewhere safe.++Your database will be available in less than a minute.++**Finding your credentials:**++You can find your project credentials inside the project [settings](https://app.supabase.com/project/_/settings/), including:++- [Database credentials](https://app.supabase.com/project/_/settings/database): connection strings and connection pooler details.+- [API credentials](https://app.supabase.com/project/_/settings/database): your serverless API URL and `anon` / `service_role` keys.diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.tsindex 58c5bb7d916..12c5df4b5d5 100644--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts@@ -868,7 +868,12 @@ export const ai: NavMenuConstant = {{name: 'Quickstarts',url: undefined,- items: [{ name: 'Python client', url: '/guides/ai/vecs-python-client' }],+ items: [+ { name: 'Developing locally with Vecs', url: '/guides/ai/vecs-python-client' },+ { name: 'Creating and managing collections', url: '/guides/ai/quickstarts/hello-world' },+ { name: 'Text Deduplication', url: '/guides/ai/quickstarts/text-deduplication' },+ { name: 'Face similarity search', url: '/guides/ai/quickstarts/face-similarity' },+ ],},{name: 'Guides',diff --git a/apps/docs/components/index.tsx b/apps/docs/components/index.tsxindex 831b1fa4027..92b92392a38 100644--- a/apps/docs/components/index.tsx+++ b/apps/docs/components/index.tsx@@ -16,6 +16,7 @@ import FunctionsExamples from './FunctionsExamples'import { Mermaid } from 'mdx-mermaid/lib/Mermaid'import RefSubLayout from '~/layouts/ref/RefSubLayout'import { Heading } from './CustomHTMLElements'+import DatabaseSetup from './MDX/database_setup.mdx'import ProjectSetup from './MDX/project_setup.mdx'import QuickstartIntro from './MDX/quickstart_intro.mdx'import SocialProviderSettingsSupabase from './MDX/social_provider_settings_supabase.mdx'@@ -66,6 +67,7 @@ const components = {FunctionsExamples,JwtGenerator,QuickstartIntro,+ DatabaseSetup,ProjectSetup,SocialProviderSetup,SocialProviderSettingsSupabase,diff --git a/apps/docs/pages/guides/ai/quickstarts/face-similarity.mdx b/apps/docs/pages/guides/ai/quickstarts/face-similarity.mdxnew file mode 100644index 00000000000..0162293d318--- /dev/null+++ b/apps/docs/pages/guides/ai/quickstarts/face-similarity.mdx@@ -0,0 +1,67 @@+import Layout from '~/layouts/DefaultGuideLayout'+import StepHikeCompact from '~/components/StepHikeCompact'++export const meta = {+ id: 'ai-vecs-python-client',+ title: 'Face similarity search',+ subtitle: 'Identify the celebrities you looks most similar to using Supabase Vecs.',+ breadcrumb: 'AI Quickstarts',+}++This guide will walk you through a ["Face Similarity Search"](https://github.com/supabase/supabase/blob/master/examples/ai/semantic_text_deduplication.ipynb) example using Colab and Supabase Vecs. You'll identify the celebrities you (or any other person) looks most similar to. You will:++1. Launch a Postgres database that uses pgvector to store embeddings+1. Launch a notebook that connects to your database+1. Load the "`ashraq/tmdb-people-image`" celebrity dataset+1. Use the `face_recognition` model to create an embedding for every celebrity photo.+1. Search for similar faces inside the dataset.++<DatabaseSetup />++## Launching a notebook++Launch a our [`semantic_text_deduplication`](https://github.com/supabase/supabase/blob/master/examples/ai/face_similarity.ipynb) notebook in Colab:++<div className="not-prose">+ <Button+ as="a"+ href="https://colab.research.google.com/github/supabase/supabase/blob/master/examples/ai/face_similarity.ipynb"+ size="medium"+ target="_blank"+ >+ Launch Notebook+ </Button>+</div>++At the top of the notebook, you'll see a button `Copy to Drive`. Click this button to copy the notebook to your Google Drive.++## Connecting to your database++Inside the Notebook, find the cell which specifies the `DB_CONNECTION`. It will contain some code like this:++```python+import vecs++DB_CONNECTION = "postgresql://<user>:<password>@<host>:<port>/<db_name>"++# create vector store client+vx = vecs.create_client(DB_CONNECTION)+```++Replace the `DB_CONNECTION` with your own connection string for your database, which you set up in first step of this guide.++## Stepping through the notebook++Now all that's left is to step through the notebook. You can do this by clicking the "execute" button (`ctrl+enter`) at the top left of each code cell. The notebook guides you through the process of creating a collection, adding data to it, and querying it.++You can view the inserted items in the [Table Editor](https://app.supabase.com/project/_/editor/), by selecting the `vecs` schema from the schema dropdown.++++## Next steps++You can now start building your own applications with Vecs. Check our [examples](/docs/guides/ai#examples) for ideas.++export const Page = ({ children }) => <Layout meta={meta} children={children} />++export default Pagediff --git a/apps/docs/pages/guides/ai/quickstarts/hello-world.mdx b/apps/docs/pages/guides/ai/quickstarts/hello-world.mdxnew file mode 100644index 00000000000..2c68e20f357--- /dev/null+++ b/apps/docs/pages/guides/ai/quickstarts/hello-world.mdx@@ -0,0 +1,67 @@+import Layout from '~/layouts/DefaultGuideLayout'+import StepHikeCompact from '~/components/StepHikeCompact'++export const meta = {+ id: 'ai-vecs-python-client',+ title: 'Creating and managing collections',+ subtitle: 'Connecting to your database with Colab.',+ breadcrumb: 'AI Quickstarts',+}++This guide will walk you through a basic ["Hello World"](https://github.com/supabase/supabase/blob/master/examples/ai/vector_hello_world.ipynb) example using Colab and Supabase Vecs. You'll learn how to:++1. Launch a Postgres database that uses pgvector to store embeddings+1. Launch a notebook that connects to your database+1. Create a vector collection+1. Add data to the collection+1. Query the collection++<DatabaseSetup />++## Launching a notebook++Launch a our [`vector_hello_world`](https://github.com/supabase/supabase/blob/master/examples/ai/vector_hello_world.ipynb) notebook in Colab:++<div className="not-prose">+ <Button+ as="a"+ href="https://colab.research.google.com/github/supabase/supabase/blob/master/examples/ai/vector_hello_world.ipynb"+ size="medium"+ target="_blank"+ >+ Launch Notebook+ </Button>+</div>++At the top of the notebook, you'll see a button `Copy to Drive`. Click this button to copy the notebook to your Google Drive.++## Connecting to your database++Inside the Notebook, find the cell which specifies the `DB_CONNECTION`. It will contain some code like this:++```python+import vecs++DB_CONNECTION = "postgresql://<user>:<password>@<host>:<port>/<db_name>"++# create vector store client+vx = vecs.create_client(DB_CONNECTION)+```++Replace the `DB_CONNECTION` with your own connection string for your database, which you set up in first step of this guide.++## Stepping through the notebook++Now all that's left is to step through the notebook. You can do this by clicking the "execute" button (`ctrl+enter`) at the top left of each code cell. The notebook guides you through the process of creating a collection, adding data to it, and querying it.++You can view the inserted items in the [Table Editor](https://app.supabase.com/project/_/editor/), by selecting the `vecs` schema from the schema dropdown.++++## Next steps++You can now start building your own applications with Vecs. Check our [examples](/docs/guides/ai#examples) for ideas.++export const Page = ({ children }) => <Layout meta={meta} children={children} />++export default Pagediff --git a/apps/docs/pages/guides/ai/quickstarts/text-deduplication.mdx b/apps/docs/pages/guides/ai/quickstarts/text-deduplication.mdxnew file mode 100644index 00000000000..6a430c2b95d--- /dev/null+++ b/apps/docs/pages/guides/ai/quickstarts/text-deduplication.mdx@@ -0,0 +1,67 @@+import Layout from '~/layouts/DefaultGuideLayout'+import StepHikeCompact from '~/components/StepHikeCompact'++export const meta = {+ id: 'ai-vecs-python-client',+ title: 'Semantic Text Deduplication',+ subtitle: 'Finding duplicate movie reviews with Supabase Vecs.',+ breadcrumb: 'AI Quickstarts',+}++This guide will walk you through a ["Semantic Text Deduplication"](https://github.com/supabase/supabase/blob/master/examples/ai/semantic_text_deduplication.ipynb) example using Colab and Supabase Vecs. You'll learn how to find similar movie reviews using embeddings, and remove any that seem like duplicates. You will:++1. Launch a Postgres database that uses pgvector to store embeddings+1. Launch a notebook that connects to your database+1. Load the IMDB dataset+1. Use the `sentence-transformers/all-MiniLM-L6-v2` model to create an embedding representing the semantic meaning of each review.+1. Search for all duplicates.++<DatabaseSetup />++## Launching a notebook++Launch a our [`semantic_text_deduplication`](https://github.com/supabase/supabase/blob/master/examples/ai/semantic_text_deduplication.ipynb) notebook in Colab:++<div className="not-prose">+ <Button+ as="a"+ href="https://colab.research.google.com/github/supabase/supabase/blob/master/examples/ai/semantic_text_deduplication.ipynb"+ size="medium"+ target="_blank"+ >+ Launch Notebook+ </Button>+</div>++At the top of the notebook, you'll see a button `Copy to Drive`. Click this button to copy the notebook to your Google Drive.++## Connecting to your database++Inside the Notebook, find the cell which specifies the `DB_CONNECTION`. It will contain some code like this:++```python+import vecs++DB_CONNECTION = "postgresql://<user>:<password>@<host>:<port>/<db_name>"++# create vector store client+vx = vecs.create_client(DB_CONNECTION)+```++Replace the `DB_CONNECTION` with your own connection string for your database, which you set up in first step of this guide.++## Stepping through the notebook++Now all that's left is to step through the notebook. You can do this by clicking the "execute" button (`ctrl+enter`) at the top left of each code cell. The notebook guides you through the process of creating a collection, adding data to it, and querying it.++You can view the inserted items in the [Table Editor](https://app.supabase.com/project/_/editor/), by selecting the `vecs` schema from the schema dropdown.++++## Next steps++You can now start building your own applications with Vecs. Check our [examples](/docs/guides/ai#examples) for ideas.++export const Page = ({ children }) => <Layout meta={meta} children={children} />++export default Page