A client application for performing encrypted vector search using homomorphic encryption.
Project description
What is enVector?
enVector is a high-performance encrypted vector search service that keeps both your vectors and similarity scores private during computation. The pyenvector Python SDK lets you talk to the enVector server from Python while keeping all sensitive data encrypted end to end.
pyenvector Example
This example walks through the typical pyenvector workflow for encrypted similarity search and vector database operations.
Install and Import
Install the SDK and import it as ev for brevity.
pip install pyenvector
import pyenvector as ev
🔍 Vector Search
1. Initialize enVector
Set up the connection to the enVector server and configure your key material.
ev.init(
host="localhost",
port=50050,
key_path="./keys",
key_id="quickstart_key",
)
2. Create Index
Create an index before inserting data. Define the index name and vector dimensionality.
index = ev.create_index("quickstart_index", dim=512)
3. Insert Data
Insert vectors into the index. The snippet below generates random 512-dimensional vectors with normalization and metadata.
import numpy as np
# Function to generate normalized random vectors
def generate_random_vector(dim):
if dim < 32 or dim > 4096:
raise ValueError(f"Invalid dimension: {dim}.")
vec = np.random.uniform(-1.0, 1.0, dim)
norm = np.linalg.norm(vec)
if norm > 0:
vec = vec / norm
return vec
# Prepare sample data
num_data = 10
db_vectors = [generate_random_vector(512) for _ in range(num_data)]
db_metadata = [f"data_{i+1}" for i in range(num_data)]
# Insert into index
index.insert(db_vectors, metadata=db_metadata)
4. Encrypted Similarity Search
Query the index and retrieve encrypted similarity scores that are decrypted on the client side.
query = db_vectors[1]
top_k = 2
result = index.search(query, top_k=top_k, output_fields=["metadata"])
print(result)
🧹 Clean Up
Remove test data and release keys when you are done.
ev.drop_index("quickstart_index")
ev.delete_key("quickstart_key")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyenvector-1.2.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyenvector-1.2.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.13, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c0b7c8121c17b9376440aeb5ab206477824a35c1a2e0634525cee3be8116ff0
|
|
| MD5 |
402b092f4716d3229928bae75afb8c08
|
|
| BLAKE2b-256 |
1fee690ca34c67e8bbe9e6c1abd268bb2472dcb4ec12806beeaa35849a226e18
|
File details
Details for the file pyenvector-1.2.2-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: pyenvector-1.2.2-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.13, manylinux: glibc 2.27+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0fdfa1b9f49f0548e906cde7b8b773de336591a144eb6c8b35dc7f9972b7a00
|
|
| MD5 |
7dd226aa65702f41ebf9729624fc10d5
|
|
| BLAKE2b-256 |
61398f0199c2ace192c660d09863a62180a92d62d45713d540970efdda32780d
|
File details
Details for the file pyenvector-1.2.2-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyenvector-1.2.2-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8febf03812e6d33bad6f4cd31a714f8e2c6a0476e05b91c39e85336739068ded
|
|
| MD5 |
b19065329279dd8e3f4f13b987aa6e70
|
|
| BLAKE2b-256 |
b657a71249b2914276da2e04fcb8e8a09071183c955a1846c45688f5136460da
|
File details
Details for the file pyenvector-1.2.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyenvector-1.2.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.12, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7adee8d560ca986e877e4a4e6dacf9cbd0ca6d8e5bdfb2da92a4db4e01950322
|
|
| MD5 |
3c06a179bf8555e972116f9a9d8eb839
|
|
| BLAKE2b-256 |
6b1d6269927b21f56c601eb1a3b745f9289bef2df6d203638c58f3d499fd30a9
|
File details
Details for the file pyenvector-1.2.2-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: pyenvector-1.2.2-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.27+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc78e95407d0b8dfa37c93ccc984a0e6d9ca7c003610ad1c5b701ca873288a25
|
|
| MD5 |
0ab54617a308dedceec69940da7d7ad7
|
|
| BLAKE2b-256 |
3666aefcead071e605b657a5df55898644a98e13b20bde5505456096197c69b1
|
File details
Details for the file pyenvector-1.2.2-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyenvector-1.2.2-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dae0c5e221ae3422e7446b58efab2995a8eaeb15a32218ab8d1271654232c103
|
|
| MD5 |
00bf39a5c35ceb95c56b92fcc3f37820
|
|
| BLAKE2b-256 |
4a8c96b4fffce4956c56e64281cc22218bacb56d17a7aed06e7bee9e71f2a8ea
|
File details
Details for the file pyenvector-1.2.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyenvector-1.2.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.11, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ce064c39cc7466c46e8c8b998aa78b225c2220e021b29df25a82b6060e38429
|
|
| MD5 |
8a535799321cacd16a02c6c335d6fae0
|
|
| BLAKE2b-256 |
87141d243a1e10533bd36aa27075efac05d0cd6436d513336f440915cd69cb8d
|
File details
Details for the file pyenvector-1.2.2-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: pyenvector-1.2.2-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.11, manylinux: glibc 2.27+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b2a5018c744544ef2bb6395fd72014f9971ef83eae6136ff48bf9cc19423967
|
|
| MD5 |
f7351e48b13044e88d35c65c25f8c618
|
|
| BLAKE2b-256 |
e46c37ad403cdad3d9c1867cff29c393902d2ff1549b0af54b4d65d477a85e13
|
File details
Details for the file pyenvector-1.2.2-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyenvector-1.2.2-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5420cebc123d5ca6ed48f516fe918b9e4623403ffe5f7dba2d23ca8997c2db76
|
|
| MD5 |
bf2d37891a96d1de903a0fbccd927e51
|
|
| BLAKE2b-256 |
43b60d3870bb53361a6d6546d0628b06cf019f879dbb4835b993f136854e6cca
|
File details
Details for the file pyenvector-1.2.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyenvector-1.2.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.10, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
546a1fee6e14db20a4198b1dc0f770d12e07adc1d62c710448b80a559e93b00e
|
|
| MD5 |
de45e0c555f9c60165cc896e6675451f
|
|
| BLAKE2b-256 |
9685776726c1b3fc67d0934a81f97faf77d178f96957def1fb3758283570556f
|
File details
Details for the file pyenvector-1.2.2-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: pyenvector-1.2.2-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.10, manylinux: glibc 2.27+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0d9db94a66bc486f03e9decf261f987943c67ce7e31f058e6154cd97d7f342c
|
|
| MD5 |
30e36e05c0d282600d615654f23a3b2a
|
|
| BLAKE2b-256 |
f48732ae3fed4ab2cd25d79deee852b41dac9d0e492ec159851d50b9d210dd25
|
File details
Details for the file pyenvector-1.2.2-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyenvector-1.2.2-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fa151e368490ea924f41c3b0eb1e473a58c3c6127b84ccc691d311e3858c4fd
|
|
| MD5 |
67443eb26b5cd8a6a84f6f23d43d5b3c
|
|
| BLAKE2b-256 |
1c2f928304b35730809106e37347c6931f80364f96e5c7d356f1563382e07d5c
|
File details
Details for the file pyenvector-1.2.2-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyenvector-1.2.2-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.9, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fe2db6cd62e53764fc84f08f7f7800d7716029ff03010e85c13806cc379f7ea
|
|
| MD5 |
47f830076edb268252423a709d6d6dab
|
|
| BLAKE2b-256 |
a21255f6c8b86db71e531fcba8b8337364075aa2a3bfc9f8231fa0c19a9125fb
|
File details
Details for the file pyenvector-1.2.2-cp39-cp39-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: pyenvector-1.2.2-cp39-cp39-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.9, manylinux: glibc 2.27+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0cfa0ecd7526af09779547fd4519375c78d8f12394e23417d467cf664a8f125
|
|
| MD5 |
84a0bced42790d4ca2c51de61dc6a3cd
|
|
| BLAKE2b-256 |
b5a7b4ad7538945a4c5c1e3c565e948d4c50e861c7ff75eccbd8aed49938114d
|
File details
Details for the file pyenvector-1.2.2-cp39-cp39-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyenvector-1.2.2-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc9289414a2c0d79936010d57ceff31178a01b1793f83181ad98366f0381232e
|
|
| MD5 |
e29d7da9d8b4996d0a08cfbe80f5af2a
|
|
| BLAKE2b-256 |
c9f1b76003d0814a892a9fc91404ed4f152b33130b2c95a44f6b7c34a3a82220
|