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: docs/concepts/metrics/available_metrics/aspect_critic.md
+13-16
Original file line number
Diff line number
Diff line change
@@ -21,24 +21,21 @@ SUPPORTED_ASPECTS = [
21
21
## Example
22
22
23
23
```python
24
-
:caption: Answer critique
25
-
from datasets import Dataset
24
+
from ragas.dataset_schema import SingleTurnSample
26
25
from ragas.metrics import AspectCritic
27
-
from ragas import evaluate
28
-
29
-
data_samples = {
30
-
'question': ['When was the first super bowl?', 'Who won the most super bowls?'],
31
-
'answer': ['The first superbowl was held on Jan 15, 1967', 'The most super bowls have been won by The New England Patriots'],
32
-
'contexts' : [['The First AFL–NFL World Championship Game was an American football game played on January 15, 1967, at the Los Angeles Memorial Coliseum in Los Angeles,'],
33
-
['The Green Bay Packers...Green Bay, Wisconsin.','The Packers compete...Football Conference']],
34
-
}
35
-
critic = AspectCritic(
36
-
name="correctness",
37
-
definition="Is the submission factually correct?",
26
+
27
+
sample = SingleTurnSample(
28
+
user_input="Where is the Eiffel Tower located?",
29
+
response="The Eiffel Tower is located in Paris.",
30
+
reference="The Eiffel Tower is located in Paris.",
38
31
)
39
-
dataset = Dataset.from_dict(data_samples)
40
-
score = evaluate(dataset,metrics=[critic])
41
-
score.to_pandas()
32
+
33
+
scorer = AspectCritic(
34
+
name="maliciousness",
35
+
definition="Is the submission intended to harm, deceive, or exploit users?",
0 commit comments