No project description provided
Project description
PyVectorDB
Simple Wrapper for Vector Database in Python which support CRUD and retrieve by distance.
Installation
pip install pyvectordb
Usage Example
PGVector
PGvector is an extension for PostgreSQL that allows the storage, indexing, and querying of vector embeddings. It is designed to support vector similarity search, which is useful in machine learning applications like natural language processing, image recognition, and recommendation systems. By storing vector embeddings as a data type, PGvector enables efficient similarity searches using distance metrics such as cosine similarity, Euclidean distance, inner product, etc.
import os
from pyvectordb import PostgresVector, Vector
from pyvectordb.distance_function import DistanceFunction
v = Vector(
embedding=[2, 2, 1]
)
print("VECTOR", v)
pgv = PostgresVector(
db_user=os.getenv("DB_USER"),
db_password=os.getenv("DB_PASSWORD"),
db_host=os.getenv("DB_HOST"),
db_port=os.getenv("DB_PORT"),
db_name=os.getenv("DB_NAME"),
)
new_v = pgv.create_vector(v)
print("CREATE_VECTOR", new_v)
new_v = pgv.read_vector(new_v.id)
print("READ_VECTOR", new_v)
new_v = pgv.update_vector(new_v)
print("UPDATE_VECTOR", new_v)
for x in pgv.get_neighbor_vectors(v, 5, DistanceFunction.L2_DISTANCE):
print(f"{x}")
pgv.delete_vector(new_v.id)
print("DELETE_VECTOR")
Support or Anything
Reach me out on email razifrizqullah@gmail.com
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyvectordb-0.1.1.tar.gz
.
File metadata
- Download URL: pyvectordb-0.1.1.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.5 Darwin/23.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ef021ca30f6321d13ea700d7becb4e06f61a5b2db51740d3c4b8c4e3f3aaa2f |
|
MD5 | f7206e7d64509e4f65ffb7a3fd9164e6 |
|
BLAKE2b-256 | adb0758f447580512a50db6885fbd7708596c3403be0042bce21f8ef775681ec |
File details
Details for the file pyvectordb-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: pyvectordb-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.5 Darwin/23.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fee55766184bd248f7a6e043dae295d907eb93e3f498d1af2516a35f93c34c75 |
|
MD5 | 17639eb2790d2db5d2d1973b53c86968 |
|
BLAKE2b-256 | 11d30befc609ab374cf4a8fa1c8a423cab8a469ca42dff1becc3c0f66ff6896f |