-
Notifications
You must be signed in to change notification settings - Fork 453
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from mr-gpt/feature/add-overall-score
Feature/add overall score
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Alert Score | ||
|
||
Alert score checks if a generated output is good or bad. It automatically checks for: | ||
|
||
- Factual consistency | ||
- Answer relevancy | ||
- Toxicness (coming soon) | ||
|
||
It then takes the minimum of those scores to alert. | ||
|
||
## Assert Alert Score | ||
|
||
```python | ||
from deepeval.metrics.alert_score import assert_alert_score | ||
assert_alert_score( | ||
generated_text="Who won the FIFA World Cup in 2018?", | ||
expected_output="French national football team", | ||
context="The FIFA World Cup in 2018 was won by the French national football team. They defeated Croatia 4-2 in the final match to claim the championship.", | ||
minimum_score=0.3 | ||
) | ||
``` | ||
|
||
## Metric | ||
|
||
```python | ||
from deepeval.metrics.alert_score import AlertScoreMetric | ||
metric = AlertScoreMetric() | ||
score = metric.measure( | ||
generated_text="Who won the FIFA World Cup in 2018?", | ||
expected_output="French national football team" | ||
) | ||
score | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters