added EvalDataset Generation
Browse files
app.py
CHANGED
|
@@ -127,12 +127,13 @@ class BSIChatbot:
|
|
| 127 |
#db = Qdrant(client=client, collection_name=self.collection_name, embeddings=embeddings, )
|
| 128 |
|
| 129 |
#Embedding, Vector generation and storing:
|
| 130 |
-
self.embedding_model
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
|
|
|
| 136 |
|
| 137 |
#index_cpu = faiss.IndexFlatL2(1024)
|
| 138 |
#res = faiss.StandardGpuResources()
|
|
@@ -554,9 +555,9 @@ class BSIChatbot:
|
|
| 554 |
print(data["Frage"])
|
| 555 |
#def ragPromptNew(self, query, rerankingStep, history, stepBackPrompt)
|
| 556 |
try:
|
| 557 |
-
print(using("PreRag"))
|
| 558 |
data["Answer"],data["Context"] = self.ragPromptNew(data["Frage"],True,None,True, True)
|
| 559 |
-
print(using("AfterRag"))
|
| 560 |
data["Answer"]=data["Answer"].choices[0].message.content
|
| 561 |
except Exception as e:
|
| 562 |
print(f"Fehler bei Eintrag {i}: {e}")
|
|
|
|
| 127 |
#db = Qdrant(client=client, collection_name=self.collection_name, embeddings=embeddings, )
|
| 128 |
|
| 129 |
#Embedding, Vector generation and storing:
|
| 130 |
+
if self.embedding_model is None:
|
| 131 |
+
self.embedding_model = HuggingFaceEmbeddings(
|
| 132 |
+
model_name=self.word_and_embed_model_path,
|
| 133 |
+
multi_process=False,
|
| 134 |
+
model_kwargs={"device": "cuda"},
|
| 135 |
+
encode_kwargs={"normalize_embeddings": True}, # Set `True` for cosine similarity
|
| 136 |
+
)
|
| 137 |
|
| 138 |
#index_cpu = faiss.IndexFlatL2(1024)
|
| 139 |
#res = faiss.StandardGpuResources()
|
|
|
|
| 555 |
print(data["Frage"])
|
| 556 |
#def ragPromptNew(self, query, rerankingStep, history, stepBackPrompt)
|
| 557 |
try:
|
| 558 |
+
print(self.using("PreRag"))
|
| 559 |
data["Answer"],data["Context"] = self.ragPromptNew(data["Frage"],True,None,True, True)
|
| 560 |
+
print(self.using("AfterRag"))
|
| 561 |
data["Answer"]=data["Answer"].choices[0].message.content
|
| 562 |
except Exception as e:
|
| 563 |
print(f"Fehler bei Eintrag {i}: {e}")
|