Skip to main content

Python client for Quiver, the security-first vector database.

Project description

quiver-client

The Python client for Quiver, the security-first vector database. Embeddings are produced by the caller — Quiver is model-agnostic.

Install

uv add quiver-client        # or: pip install quiver-client

Usage

from quiver import Client, Point

# Connect (use https:// and the api_key your server requires).
with Client("http://127.0.0.1:6333", api_key="your-api-key") as q:
    q.create_collection("items", dim=3, metric="cosine")

    q.upsert("items", [
        Point("a", [0.1, 0.2, 0.3], {"color": "red"}),
        Point("b", [0.9, 0.1, 0.0], {"color": "blue"}),
    ])

    hits = q.search(
        "items",
        [0.1, 0.2, 0.25],
        k=5,
        filter={"eq": {"field": "color", "value": "red"}},
    )
    for hit in hits:
        print(hit.id, hit.score, hit.payload)

create_collection also takes index (hnsw | vamana | disk_vamana | ivf) and pq_subspaces to select the memory-frugal disk-resident path.

For late-interaction (ColBERT) retrieval, create a collection with multivector=True, index documents as token sets with upsert_documents, and rank them by MaxSim with search_multi_vector:

q.create_collection("papers", dim=128, metric="cosine", multivector=True)
q.upsert_documents("papers", [Document("p1", token_vectors, {"title": "…"})])
hits = q.search_multi_vector("papers", query_token_vectors, k=10)

Client-side payload encryption

Seal payload fields with a key Quiver never sees (install quiver-client[encryption]). The server stores and returns ciphertext it cannot read; keep fields server-filterable by leaving them in cleartext:

from quiver import Client, Point
from quiver.encryption import PayloadCipher

cipher = PayloadCipher.from_hex("…64 hex chars…")   # a dedicated key, never the at-rest one
with Client("http://127.0.0.1:6333", api_key="…") as q:
    payload = {"tier": "gold", **cipher.seal({"ssn": "078-05-1120"})}  # tier stays filterable
    q.upsert("people", [Point("p1", [0.1, 0.2, 0.3], payload)])
    hit = q.get("people", "p1")
    secret = cipher.open(hit.payload)               # -> {"ssn": "078-05-1120"}

The envelope (XChaCha20-Poly1305) matches the Rust reference and the TypeScript SDK byte-for-byte — see client-side encryption.

Encrypted vector search (DCPE, experimental)

Encrypt the vectors themselves so the server can run nearest-neighbour search without ever seeing the plaintext embeddings (install quiver-client[dcpe]). This is property-preserving (distance-comparison- preserving) encryption — experimental, L2-only, and not semantically secure: it leaks the approximate distance-comparison relation by design. Use a dedicated key, and encrypt both the data and the queries with the same cipher.

from quiver import Client
from quiver.dcpe import DcpeCipher

cipher = DcpeCipher.from_hex("…64 hex chars…", approximation_factor=0.02)
with Client("http://127.0.0.1:6333", api_key="…") as q:
    q.create_collection("vault", dim=8, metric="l2", vector_encryption="dcpe")
    sealed = cipher.encrypt([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8])
    q.upsert("vault", [{"id": "a", "vector": sealed.ciphertext}])
    hits = q.search("vault", cipher.encrypt_query(my_query), k=10)

See ADR-0031 and docs/security/dcpe.md.

LangChain

A LangChain VectorStore adapter ships in quiver.langchain (install quiver-client[langchain]):

from quiver import Client
from quiver.langchain import QuiverVectorStore

store = QuiverVectorStore.from_texts(
    texts, embedding, client=Client(api_key="…"),
    collection="docs", index="disk_vamana", pq_subspaces=48,
)
docs = store.similarity_search("query", k=4)

Development

uv sync            # create the venv and install dependencies
uv run pytest      # run the test suite (HTTP mocked with respx)

License

AGPL-3.0-only.

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

quiver_client-0.32.0.tar.gz (307.3 kB view details)

Uploaded Source

Built Distribution

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

quiver_client-0.32.0-py3-none-any.whl (35.2 kB view details)

Uploaded Python 3

File details

Details for the file quiver_client-0.32.0.tar.gz.

File metadata

  • Download URL: quiver_client-0.32.0.tar.gz
  • Upload date:
  • Size: 307.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for quiver_client-0.32.0.tar.gz
Algorithm Hash digest
SHA256 6ac735cecc7c6c32ed0e9cecb1c985014f1a2073d3a80f1ad1a3b2990d765368
MD5 ae7f7a2ceaf5a4d2eb3bd88ff194bcbc
BLAKE2b-256 a33cfee6df6bf4f90c97c2286c007b3e2df280400f519d6f6a1ba93d1a02626f

See more details on using hashes here.

File details

Details for the file quiver_client-0.32.0-py3-none-any.whl.

File metadata

  • Download URL: quiver_client-0.32.0-py3-none-any.whl
  • Upload date:
  • Size: 35.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for quiver_client-0.32.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f8aa8b3e96dc780028ec320308a767fbab8718e48dfbb6af2d7eaefda7152319
MD5 c26043be50a19074f7db928ebe60ffe6
BLAKE2b-256 aa60bf3eeac31b2311cb9002f0170e736ed912300d123c5f57bcd28a123e12ac

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