Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

basic outline for vecs

Copple5a1ff0823a00
diff --git a/apps/docs/pages/guides/ai/vecs-for-data-scientists.mdx b/apps/docs/pages/guides/ai/vecs-for-data-scientists.mdx
index ce1fdb92e9b..6f1ab7d25d6 100644
--- a/apps/docs/pages/guides/ai/vecs-for-data-scientists.mdx
+++ b/apps/docs/pages/guides/ai/vecs-for-data-scientists.mdx
@@ -1,20 +1,121 @@
import Layout from '~/layouts/DefaultGuideLayout'
+import StepHikeCompact from '~/components/StepHikeCompact'
export const meta = {
id: 'ai-vecs-for-data-scientists',
- title: 'Vecs for data scientists',
- description: 'TBD',
- sidebar_label: 'Vecs for data scientists',
+ title: 'Vecs for Data Scientists',
+ subtitle:
+ 'Vecs is a Python client for managing vector stores in PostgreSQL using the pgvector extension.',
+ breadcrumb: 'AI Quickstarts',
}
-This guide shows ...
+<StepHikeCompact>
-## TBD
+ <StepHikeCompact.Step step={1}>
+ <StepHikeCompact.Details title="Get a database running locally">
-## See also
+ Follow the Supabase CLI [Installation](/docs/guides/cli#installation) guides to install the CLI on your machine.
-- TBD
+ You can now start a local Postgres instance in any folders using the `init` and `start` commands. Make sure you have Docker running!
-export const Page = ({ children }) => <Layout meta={meta} children={children} />
+ </StepHikeCompact.Details>
+
+ <StepHikeCompact.Code>
+
+ ```bash
+ # Initialize your project
+ supabase init
+
+ # Start Postgres
+ supabase start
+ ````
+
+ </StepHikeCompact.Code>
+
+ </StepHikeCompact.Step>
+
+ <StepHikeCompact.Step step={2}>
+
+ <StepHikeCompact.Details title="Create a collection">
+
+ [ ] Todo - what is the "npm" version of Python? Use venv?
+
+ Run this in your Terminal
+
+ </StepHikeCompact.Details>
+
+ <StepHikeCompact.Code>
+
+ ```bash Terminal
+ import vecs
+
+ # create vector store client
+ vx = vecs.create_client("postgresql://postgres:postgres@localhost:54322/postgres")
+
+ # create a collection of vectors with 3 dimensions
+ docs = vx.create_collection(name="docs", dimension=3)
+ ```
+
+ </StepHikeCompact.Code>
+
+ </StepHikeCompact.Step>
+
+ <StepHikeCompact.Step step={3}>
+ <StepHikeCompact.Details title="Add some embeddings">
+
+ Add some embeddings.
+
+ </StepHikeCompact.Details>
+
+ <StepHikeCompact.Code>
+
+ ```bash Terminal
+ import vecs
+
+ # create vector store client
+ docs = vecs.get_collection(name="docs")
+
+ # a collection of vectors with 3 dimensions
+ vectors=[
+ ("vec0", [0.1, 0.2, 0.3], {"year": 1973}),
+ ("vec1", [0.7, 0.8, 0.9], {"year": 2012})
+ ]
+
+ # insert our vectors
+ docs.upsert(vectors=vectors)
+ ```
+
+ </StepHikeCompact.Code>
+
+ </StepHikeCompact.Step>
+
+ <StepHikeCompact.Step step={4}>
+ <StepHikeCompact.Details title="Query your embeddings">
+
+ Query your embeddings.
+
+ </StepHikeCompact.Details>
+ <StepHikeCompact.Code>
+
+ ```bash Terminal
+ import Vecs
+
+ docs = vecs.get_collection(name="docs")
+
+ # query the collection filtering metadata for "year" = 2012
+ docs.query(
+ query_vector=[0.4,0.5,0.6], # required
+ limit=1, # number of records to return
+ filters={"year": {"$eq": 2012}}, # metadata filters
+ )
+ ```
+
+ </StepHikeCompact.Code>
+
+ </StepHikeCompact.Step>
+
+</StepHikeCompact>
+
+export const Page = ({ children }) => <Layout meta={meta} children={children} hideToc={true} />
export default Page