chore: import upstream snapshot with attribution
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

This commit is contained in:
wehub-resource-sync
2026-07-13 13:39:52 +08:00
commit e768098d0e
4004 changed files with 2804145 additions and 0 deletions
@@ -0,0 +1,40 @@
from promptflow.core import tool
@tool
def line_process(groundtruth: str, prediction: str) -> int:
processed_result = 0
if prediction == "JSONDecodeError" or prediction.startswith("Unknown Error:"):
processed_result = -1
return processed_result
try:
groundtruth = float(groundtruth)
prediction = float(prediction)
except ValueError:
processed_result = -1
return processed_result
if round(prediction, 2) == round(groundtruth, 2):
processed_result = 1
return processed_result
if __name__ == "__main__":
processed_result = line_process("1.0", "1")
print("The processed result is", processed_result)
processed_result = line_process("3.14", "3.1415926")
print("The processed result is", processed_result)
processed_result = line_process("2.1", "2.0")
print("The processed result is", processed_result)
processed_result = line_process("1.0", "JSONDecodeError")
print("The processed result is", processed_result)
processed_result = line_process("1.0", "No module named 'numpy'")
print("The processed result is", processed_result)