Spaces:
Runtime error
Runtime error
Update vector_store.py
Browse files- vector_store.py +4 -4
vector_store.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
import faiss
|
| 2 |
from langchain.vectorstores import FAISS
|
| 3 |
from langchain.schema import Document
|
| 4 |
-
from embeddings import
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
dim = 384 #
|
| 8 |
index = faiss.IndexFlatL2(dim)
|
| 9 |
-
vector_db = FAISS(embedding_function=
|
| 10 |
|
| 11 |
def add_document(text, doc_id):
|
| 12 |
"""Add document embeddings to FAISS."""
|
|
|
|
| 1 |
import faiss
|
| 2 |
from langchain.vectorstores import FAISS
|
| 3 |
from langchain.schema import Document
|
| 4 |
+
from embeddings import get_embedding # Import the updated embedding function
|
| 5 |
|
| 6 |
+
# FAISS parameters
|
| 7 |
+
dim = 384 # Size of the embedding (MiniLM has 384-dimensional vectors)
|
| 8 |
index = faiss.IndexFlatL2(dim)
|
| 9 |
+
vector_db = FAISS(embedding_function=get_embedding, index=index)
|
| 10 |
|
| 11 |
def add_document(text, doc_id):
|
| 12 |
"""Add document embeddings to FAISS."""
|