"""Abstrakte Backend-Schnittstelle für Vektor-DBs.""" from abc import ABC, abstractmethod from dataclasses import dataclass from typing import Dict, List @dataclass class SearchResult: chunk_id: str score: float text: str metadata: Dict class VectorBackend(ABC): @abstractmethod def index(self, chunks: List[str], payloads: List[Dict]) -> List[str]: """Indexiert Chunks, gibt chunk_ids zurück.""" ... @abstractmethod def search(self, query_embedding: List[float], limit: int = 10, filters: Dict = None) -> List[SearchResult]: """Semantische Suche mit Query-Embedding.""" ... @abstractmethod def delete(self, chunk_ids: List[str]) -> bool: """Löscht Chunks anhand ihrer IDs.""" ... @abstractmethod def health(self) -> Dict: """Gibt Status-Informationen zurück.""" ...