Files
wehub-resource-sync 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
chore: import upstream snapshot with attribution
2026-07-13 13:39:52 +08:00

34 lines
933 B
Python

from promptflow.core import tool
import json
def get_score(result):
try:
if result is not None:
# Parse the JSON string
result_dict = json.loads(result)
# Extract the score value
score = result_dict.get('score', None)
print("result: ")
print(score)
return score
else:
return None
except json.JSONDecodeError:
print("Invalid JSON string.")
return None
@tool
def concat_results(answer_relevance: str = None,
conversation_quality: str = None,
creativity: str = None,
grounding: str = None):
results = {'answer_relevance': get_score(answer_relevance),
'conversation_quality': get_score(conversation_quality),
'creativity': get_score(creativity),
'grounding': grounding}
return results