by oliverrice on 6/6/23, 1:15 PM with 2 comments
by kiwicopple on 6/6/23, 3:15 PM
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-unstructuredby oliverrice on 6/6/23, 1:32 PM
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?