Settings

Theme

Show HN: Supabase Vecs – vector client for Postgres

supabase.com

10 points by oliverrice 3 years ago · 2 comments

Reader

kiwicopple 3 years ago

for those who jump straight to the comments (like me), this is a python for managing unstructured vectors/embeddings in Postgres using pgvector. It works with any Postgres/pgvector database

The core of the API is this:

    import vecs

    DB_CONNECTION = "postgresql://<user>:<password>@<host>:<port>/<db_name>"

    # create vector store client
    vx = vecs.create_client(DB_CONNECTION)

    # create a collection of vectors with 3 dimensions
    docs = vx.create_collection(name="docs", dimension=3)
    
    # Add embeddings
    docs.upsert(vectors=[("vec0", [0.1, 0.2, 0.3], {"year": 1973})])

    # Query embeddings
    docs.query(query_vector=[0.10,0.21,0.29], limit=1)
This stores all the data in a new `vecs` schema in your database. It took me a while to grasp the nature of structured (eg, manage tables/data with migrations) with unstructured/nosql, but the use cases for vectors are very often geared towards data scientists/engineers. There is some more info about the interop between these approaches here: https://supabase.com/docs/guides/ai/structured-unstructured
oliverriceOP 3 years ago

hi, author here & happy to answer any questions

Really looking forward to the next steps with vecs and would love to hear any thoughts about the `future ideas`.

Mainly, what kind of interface would you like to see for adapters/transforms so collections can feel like you're inserting text/images/video/whatever rather than passing vectors around?

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection