You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: deepeval/metrics/answer_relevancy/template.py
+10-4Lines changed: 10 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
classAnswerRelevancyTemplate:
5
5
@staticmethod
6
6
defgenerate_statements(actual_output: str):
7
-
returnf"""Given the text, breakdown and generate a list of statements presented. Ambiguous statements and single words can also be considered as statements.
7
+
returnf"""Given the text, breakdown and generate a list of statements presented. Ambiguous statements and single words can be considered as statements, but only if outside of a coherent statement.
IMPORTANT: Please make sure to only return in JSON format, with the "statements" key mapping to a list of strings. No words or explanation is needed.
25
+
IMPORTANT: Please make sure to only return in valid and parseable JSON format, with the "statements" key mapping to a list of strings. No words or explanation are needed. Ensure all strings are closed appropriately. Repair any invalid JSON before you output it.
The provided statements are statements made in the actual output.
42
42
43
43
**
44
-
IMPORTANT: Please make sure to only return in JSON format, with the 'verdicts' key mapping to a list of JSON objects.
44
+
IMPORTANT: Please make sure to only return in valid and parseable JSON format, with the 'verdicts' key mapping to a list of JSON objects. Ensure all strings are closed appropriately. Repair any invalid JSON before you output it.
45
45
Example input:
46
46
What features does the new laptop have?
47
47
48
+
Example:
48
49
Example statements:
49
50
[
50
51
"The new laptop model has a high-resolution Retina display.",
Since you are going to generate a verdict for each statement, the number of 'verdicts' SHOULD BE STRICTLY EQUAL to the number of `statements`.
86
88
**
@@ -104,13 +106,17 @@ def generate_reason(
104
106
105
107
106
108
**
107
-
IMPORTANT: Please make sure to only return in JSON format, with the 'reason' key providing the reason.
109
+
IMPORTANT: Please make sure to only return in JSON format, with the 'reason' key providing the reason. Ensure all strings are closed appropriately. Repair any invalid JSON before you output it.
110
+
111
+
Example:
108
112
Example JSON:
109
113
{{
110
114
"reason": "The score is <answer_relevancy_score> because <your_reason>."
0 commit comments