Spaces:
Running
on
Zero
Running
on
Zero
Martín Santillán Cooper
commited on
Commit
•
e092bb5
1
Parent(s):
2e81d77
uncomment get_evaluated_component
Browse files- src/utils.py +16 -16
src/utils.py
CHANGED
@@ -58,22 +58,22 @@ def get_result_description(sub_catalog_name, criteria_name):
|
|
58 |
}
|
59 |
return messages[criteria_name]
|
60 |
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
|
78 |
def to_title_case(input_string):
|
79 |
if input_string == 'rag_hallucination_risks':
|
|
|
58 |
}
|
59 |
return messages[criteria_name]
|
60 |
|
61 |
+
def get_evaluated_component(sub_catalog_name, criteria_name):
|
62 |
+
component = None
|
63 |
+
if sub_catalog_name == 'harmful_content_in_user_prompt':
|
64 |
+
component = "user"
|
65 |
+
elif sub_catalog_name == 'harmful_content_in_assistant_response':
|
66 |
+
component = 'assistant'
|
67 |
+
elif sub_catalog_name == 'rag_hallucination_risks':
|
68 |
+
if criteria_name == "context_relevance":
|
69 |
+
component = "context"
|
70 |
+
elif criteria_name == "groundedness":
|
71 |
+
component = "assistant"
|
72 |
+
elif criteria_name == "answer_relevance":
|
73 |
+
component = "assistant"
|
74 |
+
if component is None:
|
75 |
+
raise Exception('Something went wrong getting the evaluated component')
|
76 |
+
return component
|
77 |
|
78 |
def to_title_case(input_string):
|
79 |
if input_string == 'rag_hallucination_risks':
|