Update utils.py
Browse files
utils.py
CHANGED
@@ -214,8 +214,9 @@ def document_loading_splitting():
|
|
214 |
#Chroma DB die splits ablegen - vektorisiert...
|
215 |
def document_storage_chroma(splits):
|
216 |
#HF embeddings--------------------------------------
|
217 |
-
Chroma.from_documents(documents = splits, embedding = HuggingFaceEmbeddings(model_name="sentence-transformers/all-mpnet-base-v2", model_kwargs={"device": "cpu"}, encode_kwargs={'normalize_embeddings': False}), persist_directory = PATH_WORK + CHROMA_DIR)
|
218 |
-
|
|
|
219 |
|
220 |
############################################
|
221 |
#dokumente in chroma db vektorisiert ablegen können - die Db vorbereiten daüfur
|
|
|
214 |
#Chroma DB die splits ablegen - vektorisiert...
|
215 |
def document_storage_chroma(splits):
|
216 |
#HF embeddings--------------------------------------
|
217 |
+
vectorstore = Chroma.from_documents(documents = splits, embedding = HuggingFaceEmbeddings(model_name="sentence-transformers/all-mpnet-base-v2", model_kwargs={"device": "cpu"}, encode_kwargs={'normalize_embeddings': False}), persist_directory = PATH_WORK + CHROMA_DIR)
|
218 |
+
retriever = vectorstore.as_retriever(search_kwargs = {"k": ANZAHL_DOCS})
|
219 |
+
return vectorstore, retriever
|
220 |
|
221 |
############################################
|
222 |
#dokumente in chroma db vektorisiert ablegen können - die Db vorbereiten daüfur
|