Files
gps-denied-desktop/helpers/faiss_index_manager.py
T
Oleksandr Bezdieniezhnykh abc26d5c20 initial structure implemented
docs -> _docs
2025-12-01 14:20:56 +02:00

35 lines
954 B
Python

from typing import Optional
import numpy as np
class FaissIndexManager:
def __init__(self, dimension: int, index_type: str = "IVF"):
self._dimension = dimension
self._index_type = index_type
self._index = None
self._id_map: dict[int, str] = {}
def build_index(self, vectors: np.ndarray, ids: list[str]) -> bool:
raise NotImplementedError
def add_vectors(self, vectors: np.ndarray, ids: list[str]) -> bool:
raise NotImplementedError
def search(
self, query: np.ndarray, top_k: int = 10
) -> list[tuple[str, float]]:
raise NotImplementedError
def remove_vectors(self, ids: list[str]) -> bool:
raise NotImplementedError
def save_index(self, path: str) -> bool:
raise NotImplementedError
def load_index(self, path: str) -> bool:
raise NotImplementedError
def get_vector_count(self) -> int:
raise NotImplementedError