from_faiss

from_faiss(
    faiss_index,
    path,
    compression='zstd',
    quantization='float16',
    metadata=None,
    stored_fields=None,
)

Build a dyf lazy index file from a FAISS IVF index.

Extracts FAISS’s inverted lists and centroids, builds a single-level dyf tree (one node per IVF cell), and writes to the dyf file format.

Parameters

Name Type Description Default
faiss_index A trained faiss.IndexIVFFlat or faiss.IndexIVFPQ. required
path str Output file path (e.g., “index.dyf”). required
compression str “none”, “zstd”, or “lz4” (default: “none”). 'zstd'
quantization str “float32”, “float16”, or “int8” (default: “float16”). 'float16'
metadata dict[str, str] | None Optional dict of string key-value pairs. None
stored_fields Mapping[str, StoredFieldInput] | None Optional dict mapping field name to array-like of length n_items (indexed by FAISS ID). None

Returns

Name Type Description
LazyIndex LazyIndex opened on the written file.