hoops_ai.ml.embeddings.FaissVectorStore
- class hoops_ai.ml.embeddings.FaissVectorStore(dim)
Bases:
VectorStoreFAISS (in-memory) storage and retrieval of high-dimensionalvector store implementation.
Efficient storage and retrieval of high-dimensional vectors with support for similarity search, metadata filtering, and CRUD operations.
- Parameters:
dim (int)
- close()
Close the vector store and release resources.
- Return type:
None
- count()
Return total number of vectors in the store.
- Returns:
Number of stored vectors
- Return type:
- delete(ids)
Delete vectors by their ids.
- get_ids()
Return list of all indexed vector IDs.
- Returns:
List of all vector IDs currently in the store
- Return type:
List[str]
- classmethod load(path)
Load a persisted vector store from disk or restore connection.
For local stores (e.g., FAISS): Deserializes index and metadata from file. For cloud stores (e.g., Weaviate, Qdrant): Restores connection to existing index.
- Parameters:
path (str) – File path for local stores, or identifier for cloud stores
- Returns:
Restored vector store instance
- Return type:
VectorStore
- query(query_vector, top_k=10, filters=None, include_metadata=True)
Search for similar vectors.
- Parameters:
- Returns:
List of VectorHit objects sorted by similarity score (descending)
- Return type:
- upsert(records)
Insert or update vector records.
- Parameters:
records (Sequence[VectorRecord]) – Sequence of VectorRecord objects to store
- Return type:
None