pgvector client
Project Links
Meta
Author: Oliver Rice
Classifiers
Development Status
- 4 - Beta
Natural Language
- English
Operating System
- OS Independent
Programming Language
- Python
- Python :: 3
- Python :: 3.8
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
vecs
Documentation: https://supabase.github.io/vecs/latest/
Source Code: https://github.com/supabase/vecs
vecs is a python client for managing and querying vector stores in PostgreSQL with the pgvector extension. This guide will help you get started with using vecs.
If you don't have a Postgres database with the pgvector ready, see hosting for easy options.
Installation
Requires:
- Python 3.7+
You can install vecs using pip:
pip install vecs
Usage
Visit the quickstart guide for more complete info.
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.get_or_create_collection(name="docs", dimension=3)
# add records to the *docs* collection
docs.upsert(
records=[
(
"vec0", # the vector's identifier
[0.1, 0.2, 0.3], # the vector. list or np.array
{"year": 1973} # associated metadata
),
(
"vec1",
[0.7, 0.8, 0.9],
{"year": 2012}
)
]
)
# index the collection for fast search performance
docs.create_index()
# query the collection filtering metadata for "year" = 2012
docs.query(
data=[0.4,0.5,0.6], # required
limit=1, # number of records to return
filters={"year": {"$eq": 2012}}, # metadata filters
)
# Returns: ["vec1"]
0.4.5
Dec 13, 2024
0.4.4
Jul 31, 2024
0.4.3
Feb 28, 2024
0.4.2
Dec 12, 2023
0.4.1
Sep 27, 2023
0.4.0
Sep 15, 2023
0.3.1
Sep 08, 2023
0.3.0
Jul 26, 2023
0.2.6
Jun 01, 2023
0.2.4
May 19, 2023
0.2.3
May 19, 2023
0.2.2
May 17, 2023
0.2.1
May 17, 2023
0.1.0
May 15, 2023
Files in release
No dependencies