e768098d0e
tools_continuous_delivery / Private PyPI non-main branch release (push) Has been skipped
tools_continuous_delivery / Private PyPI main branch release (push) Failing after 2m42s
Publish Promptflow Doc / Build (push) Has been cancelled
Publish Promptflow Doc / Deploy (push) Has been cancelled
Flake8 Lint / flake8 (push) Has been cancelled
Spell check CI / Spell_Check (push) Has been cancelled
22 lines
775 B
Python
22 lines
775 B
Python
from promptflow.core import tool
|
|
|
|
|
|
@tool
|
|
def select_metrics(metrics: str) -> str:
|
|
supported_metrics = ('grounding',
|
|
'answer_relevance',
|
|
'answer_quality',
|
|
'context_recall',
|
|
'context_precision',
|
|
'answer_similarity',
|
|
'answer_correctness',
|
|
'creativity')
|
|
user_selected_metrics = [metric.strip() for metric in metrics.split(',') if metric]
|
|
metric_selection_dict = {}
|
|
for metric in supported_metrics:
|
|
if metric in user_selected_metrics:
|
|
metric_selection_dict[metric] = True
|
|
else:
|
|
metric_selection_dict[metric] = False
|
|
return metric_selection_dict
|