elips.Client() and elips.PersistentClient() are the entry points for opening an ELIPS database in Python. They create the underlying C++ database and expose the Chroma-style client surface (create_collection, get_or_create_collection, list_collections, …) through a high-level Engine handle.
Overview
Client opens an ephemeral, in-memory database; PersistentClient opens (or creates) one on disk. ELIPS is dimension-first, so a dimension (or a dimension-fixing embedder) is required. The pre-1.1 openers elips.connect() / elips.open() / elips.Engine still work as deprecated shims.
Client & PersistentClient
import elips
# Ephemeral, in-memory
client = elips.Client(dimension=384, metric="cosine")
# On disk (opens or creates)
client = elips.PersistentClient("./my_db", dimension=384)
docs = client.get_or_create_collection("documents")Settings
Both clients accept the same keyword settings:
dimension— vector dimension. Required for in-memory and new databases.metric—"cosine"(default),"euclidean", or"dot_product".index—"graph"(default, HNSW) or"exact"(flat).access_mode—"read_write"(default) or"read_only".embedder— a Python callable orLocalEmbedderConfig.quantization— aQuantParamsor a codec name ("sq8","pq","opq").device—"cpu","auto","metal","cuda:N", or"hip:N"(see GPU); or pass agpu=GpuConfig(...).segmented_storage,metadata_acceleration,use_default_text_embedder— persistence and embedder toggles.
There is no index_type, no durability=, and no gpu=True keyword — those never existed on the opener. Durability is configured on the native Config; see Durability.
connect() (deprecated)
def connect(
path: str,
*,
dimension: int = 0,
metric: str = "cosine", # "cosine" | "euclidean" | "dot_product"
index: str = "graph", # "graph" (HNSW) | "exact" (flat)
access_mode: str = "read_write", # "read_write" | "read_only"
embedder = None,
quantization = None, # QuantParams | "sq8" | "pq" | "opq"
gpu = None, # GpuConfig | None
device: str | None = None, # "cpu" | "auto" | "metal" | "cuda:N" | "hip:N"
fallback: bool = False,
) -> Engine: ... # deprecated shim; prefer Client / PersistentClientEmbedder integration
Pass any text-to-vector embedding function matching the Embedder protocol (e.g. SentenceTransformers, OpenAI, Ollama):
from sentence_transformers import SentenceTransformer
import elips
model = SentenceTransformer("all-MiniLM-L6-v2")
with elips.PersistentClient("./my_db", dimension=384, embedder=model.encode) as client:
docs = client.get_or_create_collection("docs")
docs.add(documents=["ELIPS makes vector search embedded and fast."])
hits = docs.query(query_texts="fast vector search", n_results=3)
print(hits[0].text)Context manager usage
Using a client inside a with block flushes, checkpoints, and closes the database cleanly on exit:
with elips.PersistentClient("vectors.elips", dimension=1536) as client:
# read/write operations
pass
# database handle is safely closed hereCode examples
In-memory volatile DB
import elips
with elips.Client(dimension=64, metric="euclidean") as client:
quick = client.get_or_create_collection("quick_test")
quick.add(embeddings=[[0.1] * 64], metadatas=[{"tag": "test"}])Persistent disk DB with GPU acceleration
import elips
with elips.PersistentClient("./gpu_db", dimension=1536, device="metal") as client:
print(f"Backend: {client.native.gpu_info().backend}")