geronimo-pericoli
commited on
Commit
•
091d09c
1
Parent(s):
99e002f
Update app.py
Browse files
app.py
CHANGED
@@ -345,7 +345,7 @@ def ctx_relevancy_eval():
|
|
345 |
# Extraer los textos de los source nodes
|
346 |
contexts = []
|
347 |
for node in source_nodes:
|
348 |
-
if node.score <=
|
349 |
text = node.node.text.strip()
|
350 |
contexts.append(text)
|
351 |
|
@@ -366,13 +366,11 @@ def ctx_relevancy_eval():
|
|
366 |
|
367 |
def faithfulness_eval():
|
368 |
global final_response
|
369 |
-
global query
|
370 |
evaluator = FaithfulnessEvaluator(llm=gpt4omini)
|
371 |
-
eval_result = evaluator.evaluate_response(
|
372 |
|
373 |
print("Groundedness: " + str(eval_result.score) + " - " + str(eval_result.passing) + "\n")
|
374 |
-
print("Respuesta: " + str(final_response) + "\n")
|
375 |
-
print("Query: " + str(query) + "\n\n----------")
|
376 |
return float(eval_result.score)
|
377 |
|
378 |
def ans_relevancy_eval():
|
@@ -441,6 +439,7 @@ def evaluate():
|
|
441 |
|
442 |
|
443 |
|
|
|
444 |
|
445 |
|
446 |
chat_history_engine = []
|
|
|
345 |
# Extraer los textos de los source nodes
|
346 |
contexts = []
|
347 |
for node in source_nodes:
|
348 |
+
if node.score <= 1: # Excluir nodos con score > 1
|
349 |
text = node.node.text.strip()
|
350 |
contexts.append(text)
|
351 |
|
|
|
366 |
|
367 |
def faithfulness_eval():
|
368 |
global final_response
|
|
|
369 |
evaluator = FaithfulnessEvaluator(llm=gpt4omini)
|
370 |
+
eval_result = evaluator.evaluate_response(response=final_response)
|
371 |
|
372 |
print("Groundedness: " + str(eval_result.score) + " - " + str(eval_result.passing) + "\n")
|
373 |
+
print("Respuesta: " + str(final_response) + "\n\n----------")
|
|
|
374 |
return float(eval_result.score)
|
375 |
|
376 |
def ans_relevancy_eval():
|
|
|
439 |
|
440 |
|
441 |
|
442 |
+
|
443 |
|
444 |
|
445 |
chat_history_engine = []
|