summaryrefslogtreecommitdiff
path: root/rag/db/vector.py
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2024-04-05 00:42:19 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2024-04-05 00:42:19 +0200
commit0a6b7793e982d4c59f3c6ffb947dfe28ca709cdc (patch)
tree10ae6893d2c901b04f63c5f9e15cb2678b87ce98 /rag/db/vector.py
parent1cf0a401054c3e3ebde60bfd73ad15e39bc531e6 (diff)
Rename
Diffstat (limited to 'rag/db/vector.py')
-rw-r--r--rag/db/vector.py23
1 files changed, 0 insertions, 23 deletions
diff --git a/rag/db/vector.py b/rag/db/vector.py
deleted file mode 100644
index f229ba7..0000000
--- a/rag/db/vector.py
+++ /dev/null
@@ -1,23 +0,0 @@
-from typing import Tuple
-import faiss
-import numpy as np
-
-# TODO: read from .env
-EMBEDDING_DIM = 1024
-
-
-# TODO: inner product distance metric?
-class VectorStore:
- def __init__(self):
- self.index = faiss.IndexFlatL2(EMBEDDING_DIM)
- # TODO: load from file
-
- def add(self, embeddings: np.ndarray):
- # TODO: save to file
- self.index.add(embeddings)
-
- def search(
- self, query: np.ndarray, neighbors: int = 4
- ) -> Tuple[np.ndarray, np.ndarray]:
- score, indices = self.index.search(query, neighbors)
- return score, indices