added EvalDataset Generation
Browse files
app.py
CHANGED
@@ -57,6 +57,7 @@ login(token=HF_KEY)
|
|
57 |
vectorstore=None
|
58 |
rerankingModel=None
|
59 |
bm25_retriever=None
|
|
|
60 |
|
61 |
class BSIChatbot:
|
62 |
embedding_model = None
|
@@ -269,13 +270,14 @@ class BSIChatbot:
|
|
269 |
|
270 |
def retrieveDocFromFaiss(self):
|
271 |
global vectorstore
|
272 |
-
|
273 |
all_documents = []
|
274 |
|
275 |
#print(vectorstore.index_to_docstore_id)
|
276 |
#newprint(vectorstore)
|
277 |
# Iteriere über alle IDs im index_to_docstore_id
|
278 |
-
|
|
|
279 |
|
280 |
#for doc_id in vectorstore.index_to_docstore_id.values():
|
281 |
for entry in docs:
|
@@ -732,7 +734,8 @@ class BSIChatbot:
|
|
732 |
i=i+1
|
733 |
|
734 |
with open('/home/user/app/docs/_eval/eval_dataset.json', 'w') as fout:
|
735 |
-
json.dump(
|
|
|
736 |
# Print full response as JSON
|
737 |
# print(chat_completion)
|
738 |
|
|
|
57 |
vectorstore=None
|
58 |
rerankingModel=None
|
59 |
bm25_retriever=None
|
60 |
+
docstore=None
|
61 |
|
62 |
class BSIChatbot:
|
63 |
embedding_model = None
|
|
|
270 |
|
271 |
def retrieveDocFromFaiss(self):
|
272 |
global vectorstore
|
273 |
+
global docstore
|
274 |
all_documents = []
|
275 |
|
276 |
#print(vectorstore.index_to_docstore_id)
|
277 |
#newprint(vectorstore)
|
278 |
# Iteriere über alle IDs im index_to_docstore_id
|
279 |
+
if docstore == None:
|
280 |
+
docstore = vectorstore.docstore._dict.values()
|
281 |
|
282 |
#for doc_id in vectorstore.index_to_docstore_id.values():
|
283 |
for entry in docs:
|
|
|
734 |
i=i+1
|
735 |
|
736 |
with open('/home/user/app/docs/_eval/eval_dataset.json', 'w') as fout:
|
737 |
+
json.dump(data, fout, ensure_ascii=False)
|
738 |
+
fout.write("\n")
|
739 |
# Print full response as JSON
|
740 |
# print(chat_completion)
|
741 |
|