Skip to main content

Encrypted Vector Database for Secure and Fast ANN Searches

Project description

VectorX - Encrypted Vector Database

VectorX is an encrypted vector database designed for maximum security and speed. Utilizing client-side encryption with private keys, VectorX ensures data confidentiality while enabling rapid Approximate Nearest Neighbor (ANN) searches within encrypted datasets. Leveraging a proprietary algorithm, VectorX provides unparalleled performance and security for applications requiring robust vector search capabilities in an encrypted environment.

Key Features

  • Client-side Encryption: Vectors are encrypted using private keys before being sent to the server
  • Fast ANN Searches: Efficient similarity searches on encrypted vector data
  • Multiple Distance Metrics: Support for cosine, L2, and inner product distance metrics
  • Metadata Support: Attach and search with metadata and filters
  • High Performance: Optimized for speed and efficiency with encrypted data

Installation

pip install vecx

Quick Start

from vecx.vectorx import VectorX

# Initialize client with your API token
vx = VectorX(token="your_user_id:your_api_token:region")

# Generate a secure encryption key
encryption_key = vx.generate_key()

# Create a new index
vx.create_index(
    name="my_vectors",
    dimension=1536,  # Your vector dimension
    key=encryption_key,  # Encryption key
    space_type="cosine"  # Distance metric (cosine, l2, ip)
)

# Get index reference
index = vx.get_index(name="my_vectors", key=encryption_key)

# Insert vectors
index.upsert([
    {
        "id": "doc1",
        "vector": [0.1, 0.2, 0.3, ...],  # Your vector data
        "meta": {"text": "Example document", "category": "reference"}
    }
])

# Query similar vectors
results = index.query(
    vector=[0.2, 0.3, 0.4, ...],  # Query vector
    top_k=10,
    filter={"category": "reference"}  # Optional filter
)

# Process results
for item in results:
    print(f"ID: {item['id']}, Similarity: {item['similarity']}")
    print(f"Metadata: {item['meta']}")

Basic Usage

Initializing the Client

from vecx.vectorx import VectorX

# Production with specific region
vx = VectorX(token="user_id:api_token:region")

Managing Indexes

# List all indexes
indexes = vx.list_indexes()

# Create an index with custom parameters
vx.create_index(
    name="my_custom_index",
    dimension=384,
    key=encryption_key,
    space_type="l2",
    M=32,             # Graph connectivity parameter
    ef_con=200,       # Construction-time parameter
    use_fp16=True     # Use half-precision for storage optimization
)

# Delete an index
vx.delete_index("my_index")

Working with Vectors

# Get index reference
index = vx.get_index(name="my_index", key=encryption_key)

# Insert multiple vectors in a batch
index.upsert([
    {
        "id": "vec1",
        "vector": [...],  # Your vector
        "meta": {"title": "First document", "tags": ["important"]}
    },
    {
        "id": "vec2",
        "vector": [...],  # Another vector
        "filter": {"visibility": "public"}  # Optional filter values
    }
])

# Query with custom parameters
results = index.query(
    vector=[...],      # Query vector
    top_k=5,           # Number of results to return
    filter={"tags": "important"},  # Filter for matching
    ef=128,            # Runtime parameter for search quality
    include_vectors=True  # Include vector data in results
)

# Delete vectors
index.delete_vector("vec1")
index.delete_with_filter({"visibility": "public"})

# Get a specific vector
vector = index.get_vector("vec1")

API Reference

VectorX Class

  • __init__(token=None): Initialize with optional API token
  • set_token(token): Set API token
  • set_base_url(base_url): Set custom API endpoint
  • generate_key(): Generate a secure encryption key
  • create_index(name, dimension, key, space_type, ...): Create a new index
  • list_indexes(): List all indexes
  • delete_index(name): Delete an index
  • get_index(name, key): Get reference to an index

Index Class

  • upsert(input_array): Insert or update vectors
  • query(vector, top_k, filter, ef, include_vectors): Search for similar vectors
  • delete_vector(id): Delete a vector by ID
  • delete_with_filter(filter): Delete vectors matching a filter
  • get_vector(id): Get a specific vector
  • describe(): Get index statistics and info

Security Considerations

  • Key Management: Store your encryption key securely. Loss of the key will result in permanent data loss.
  • Client-Side Encryption: All sensitive data is encrypted before transmission.

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 Distribution

vecx-0.33.0b1.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vecx-0.33.0b1-py3-none-any.whl (1.5 MB view details)

Uploaded Python 3

File details

Details for the file vecx-0.33.0b1.tar.gz.

File metadata

  • Download URL: vecx-0.33.0b1.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for vecx-0.33.0b1.tar.gz
Algorithm Hash digest
SHA256 72ddd302916851a938c6ab6c5098c2606a4ed158ebdafee00b9960895f59fe1c
MD5 46deff2099a133fd4ef69e7e69e1f09e
BLAKE2b-256 d4dceaf8bde18f980d8af4ada3242eb22b85e1c34aedf6bf503e361c585b72bf

See more details on using hashes here.

File details

Details for the file vecx-0.33.0b1-py3-none-any.whl.

File metadata

  • Download URL: vecx-0.33.0b1-py3-none-any.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for vecx-0.33.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 4539d1f616eb2dbf2e5de3edc795d0d54dc87e39b4af98b75ab0597d59a1315c
MD5 051f338e115a6bfbb748c885ae683d7f
BLAKE2b-256 073e2b579c3ceab071144e32687e4fcadd548868de262606cc2eb1a2bc2bb87d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page