Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- data_processing.py +1 -1
- evaluation.py +3 -2
data_processing.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import numpy as np
|
2 |
-
|
3 |
from langchain.embeddings import HuggingFaceEmbeddings
|
4 |
from sentence_transformers import SentenceTransformer
|
5 |
from datasets import load_dataset
|
|
|
1 |
import numpy as np
|
2 |
+
import faiss
|
3 |
from langchain.embeddings import HuggingFaceEmbeddings
|
4 |
from sentence_transformers import SentenceTransformer
|
5 |
from datasets import load_dataset
|
evaluation.py
CHANGED
@@ -8,14 +8,15 @@ ground_truth_answer = ''
|
|
8 |
ground_truth_metrics = {}
|
9 |
|
10 |
|
11 |
-
def calculate_metrics(question, response, docs,data):
|
12 |
retrieve_ground_truths(question,data)
|
13 |
# Predicted metrics
|
14 |
predicted_metrics = {
|
15 |
"context_relevance": context_relevance(question, docs),
|
16 |
"context_utilization": context_utilization(response, docs),
|
17 |
"completeness": completeness(response, ground_truth_answer),
|
18 |
-
"adherence": adherence(response, docs)
|
|
|
19 |
}
|
20 |
return predicted_metrics
|
21 |
|
|
|
8 |
ground_truth_metrics = {}
|
9 |
|
10 |
|
11 |
+
def calculate_metrics(question, response, docs,data, time_taken):
|
12 |
retrieve_ground_truths(question,data)
|
13 |
# Predicted metrics
|
14 |
predicted_metrics = {
|
15 |
"context_relevance": context_relevance(question, docs),
|
16 |
"context_utilization": context_utilization(response, docs),
|
17 |
"completeness": completeness(response, ground_truth_answer),
|
18 |
+
"adherence": adherence(response, docs),
|
19 |
+
"response_time" : time_taken
|
20 |
}
|
21 |
return predicted_metrics
|
22 |
|