Overview
VectorizeDB is a Python package designed for the efficient storage and retrieval of high-dimensional vectors. It’s particularly useful in applications like machine learning and information retrieval. The package utilizes hnswlib for fast approximate nearest neighbor searches and LMDB for scalable and reliable storage.
Installation
To install VectorizeDB, ensure you have Python 3.10 or higher. It can be installed via pip:
pip install vectorizedb
Usage
Initialization
from vectorizedb import Database
# Initialize a new database
db = Database(path="path/to/db", dim=128, readonly=False, similarity="cosine")
Adding Data
import numpy as np
# Add a vector with an associated key
db.add(key="sample_key", vector=np.random.rand(128))
# Add a vector with metadata
db.add(key="another_key", vector=np.random.rand(128), metadata={"info": "sample metadata"})
# Another way to add data
db["yet_another_key"] = (np.random.rand(128), {"info": "sample metadata"})
Retrieving Data
# Retrieve vector and metadata by key
vector, metadata = db["sample_key"]
# Check if a key exists in the database
exists = "sample_key" in db
Searching
# Search for nearest neighbors of a vector
results = db.search(vector=np.random.rand(128), k=5)
for key, vector, distance, metadata in results:
print(key, distance, metadata)
Iterating Through Data
# Iterate through all keys, vectors and metadata in the database
for key, vector, metadata in db:
print(key, metadata)
Updating Data
# Update a vector in the database
db.update_vector("sample_key", np.random.rand(128))
# Update metadata
db.update_metadata("sample_key", {"info": "updated metadata"})
Deleting Data
# Delete a vector from the database by key
del db["sample_key"]
Database Length
# Get the number of entries in the database
length = len(db)
License
VectorizeDB is released under the Apache License. For more details, see the LICENSE file included in the package.
Metadata
Release files for vectorizedb 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| vectorizedb-1.0.0.tar.gz | 8.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vectorizedb-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.4 kB
Release files / vectorizedb-1.0.0.tar.gz
| Download URL | vectorizedb-1.0.0.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58871f06cf303b078a0c0dee71da401243e44ffb81e1dcfadce13c49ce9a029a
|
|
BLAKE2b-256 checksum How to use checksums |
ed3eb760e77e62001a3eac507aded33a9339978aa65b52d705cc8a0a2e26a640
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1019-azure
|
Release files / vectorizedb-1.0.0-py3-none-any.whl
| Download URL | vectorizedb-1.0.0-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dbadd21a5951cfc8a8e991a3b147b03238b3f95bb500930262b55b8989d3a880
|
|
BLAKE2b-256 checksum How to use checksums |
d098c452a4ec786010620a3a6f3fcad4d97e67b83c337c73436840ec80eb0605
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1019-azure
|
Security for vectorizedb 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.