Load the vectors from a path.
(cls, path: Path)
| 131 | |
| 132 | @classmethod |
| 133 | def load(cls, path: Path) -> BasicBackend: |
| 134 | """Load the vectors from a path.""" |
| 135 | arguments = BasicArgs.load(path / "arguments.json") |
| 136 | vectors = cls._load_vectors(path) |
| 137 | if arguments.metric == Metric.COSINE: |
| 138 | return CosineBasicBackend(vectors, arguments) |
| 139 | elif arguments.metric == Metric.EUCLIDEAN: |
| 140 | return EuclideanBasicBackend(vectors, arguments) |
| 141 | else: |
| 142 | raise ValueError(f"Unsupported metric: {arguments.metric}") |
| 143 | |
| 144 | def save(self, path: Path) -> None: |
| 145 | """Save the vectors to a path.""" |
no test coverage detected