Skip to main content

Official Python SDK for the Elasti platform (encrypted vector database)

Project description

elasti (Python SDK)

Official Python SDK for the Elasti platform. client.vectors is the end-to-end encrypted vector database: embeddings are encrypted on-device with a secret key that never leaves your machine, similarity search runs homomorphically server-side, and scores decrypt locally. The server only ever sees ciphertext — your data, your queries, and your results stay unreadable to everyone but you.

Install

pip install elasti            # SDK
pip install "elasti[demo]"    # + sentence-transformers for the example

The SDK binds the native bridge via ctypes. Point it at the library if it is not in a standard location:

export ELASTI_BRIDGE_LIB=/path/to/libelastibridge.so

Quick start

An API key from the dashboard is the only credential you need. Bring your own embeddings — any model, any pipeline:

import os
from elasti import Elasti

client = Elasti(api_key=os.environ["ELASTI_API_KEY"])

index = client.vectors.index("default")   # first run generates keys locally

encrypted = index.encrypt_embeddings(vectors)   # local, secret-key encryption
index.upload(encrypted)                          # only ciphertext leaves

for r in index.search(query_vector, top_k=5):
    print(r.id, r.score)
  • The first index() call generates your full key set on this machine (~30s) and uploads only the public evaluation keys (~1 GB, one time, via presigned URLs). The secret key is written to ~/.elasti/ and is never transmitted anywhere.
  • encrypt_embeddings(vectors) seals each embedding locally (~34 KB of ciphertext per vector).
  • upload(encrypted) stages the ciphertext and returns insertion-order ids; map ids to your own records however you like.
  • search(embedding) encrypts the query locally, scores every stored vector blindly server-side, and decrypts the scoreboard back on this machine. Scores are inner products (cosine similarity if your embeddings are normalized).
  • sync() blocks until recent uploads are packed and searchable; search() calls it automatically when needed.

Multiple indexes

Your account has one key set and any number of named indexes. Extra indexes are cheap — they share your keys and only add their own storage — and every search is scoped to one index:

notes  = client.vectors.index("notes")
photos = client.vectors.index("photos")

Index names: lowercase alphanumerics, dash, underscore, max 64 chars.

Key backup and portability

The secret key is the only way to decrypt an index — back it up:

index.save_key("~/backups/elasti.key")   # export to a file
raw = index.export_key()                  # or raw bytes for a vault/KMS

# on a new machine, open your data with the exported key:
index = client.vectors.index("default", key_file="~/backups/elasti.key")
index = client.vectors.index("default", key=raw)

If a different key already exists locally, index() refuses to overwrite it.

Example

examples/encrypted_search.py stores passages from 1984, Fahrenheit 451, Brave New World, and other novels about surveillance — encrypted, in a database that for once actually can't read them — then answers semantic queries over them end to end:

ELASTI_API_KEY=elasti_sk_... python examples/encrypted_search.py

Security model

  • The secret key is generated on your machine and never leaves it.
  • Encrypted embeddings (~34 KB/vector) and queries (~34 KB) are ciphertext end to end.
  • The server computes inner products blindly and returns encrypted scoreboards; ranking happens after local decryption.
  • Rate limits apply per API key during the developer preview; requests return Retry-After and the SDK backs off automatically.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

elasti-0.1.0-py3-none-manylinux_2_38_x86_64.whl (2.2 MB view details)

Uploaded Python 3manylinux: glibc 2.38+ x86-64

elasti-0.1.0-py3-none-macosx_11_0_arm64.whl (2.0 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file elasti-0.1.0-py3-none-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for elasti-0.1.0-py3-none-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 0cb92db7228c057a6ac96c25bf487ed716cc69b6bd18b917053cb5e0f6e6b473
MD5 82e3c11a09103d15243c6fe1d06189ea
BLAKE2b-256 e19e4562d373cf2c1e2a7ff3bf2069fba965c5c7e64d8dbc6f37e84c30199b92

See more details on using hashes here.

File details

Details for the file elasti-0.1.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for elasti-0.1.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b5389a55768b810b72652d3457958d7cf38a770bd73ac843b1fbc0fc398b167e
MD5 a93d28508d104b4c6653aa7d1a48aa1c
BLAKE2b-256 ea67ee644f5e7be2fbaad945a312be0d9b2cee676afb9c9eb894f5f5a9ec77f2

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