denselinkage.indexing.FaissSearchableIndex¶
- class denselinkage.indexing.FaissSearchableIndex(index: Any, ids: Sequence[str])[source]¶
Bases:
SearchableIndexImmutable artifact built by
FaissFlatIndex— exact (flat) inner-product nearest-neighbour search over afaiss.IndexFlatIP.Inner product equals cosine for the L2-normalized vectors the embedders produce, so this artifact answers the same similarity as
NumpySearchableIndexand thesimilarity_thresholdkeeps its meaning across the numpy and FAISS backends. The vectors are fixed at build time (noadd);extended()is the not-yet-implemented escape hatch.- property vectors: Any¶
The indexed vectors (float32,
n_records x embedding_dim), as a read-only array reconstructed from the FAISS index — this artifact is immutable.
- extended(vectors: Any, ids: Sequence[str]) FaissSearchableIndex[source]¶
Return a NEW artifact holding this index’s vectors plus
vectors; this instance is left unchanged (the immutable-artifact guarantee).idsalign positionally withvectorsand must be disjoint from the ids already indexed;vectorsmust match the indexed width orDimensionMismatchis raised.Incremental indexing is out of scope for v1, so the v1 reference artifacts raise
NotImplementedErrorrather than returningNone; the signature is fixed pre-freeze so the capability can land later without a breaking change.