Skip to content

Commit

Permalink
Merge pull request #4 from futurice/feature-math-coding
Browse files Browse the repository at this point in the history
update outputs
  • Loading branch information
rachhek authored Dec 5, 2024
2 parents 167b179 + c958991 commit 6b6520f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion math_coding/flows/math_evaluation_flow/flow.dag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inputs:
default: "2"
outputs:
score:
type: integer
type: string
reference: ${line_process.output}
metrics:
type: object
Expand Down
8 changes: 4 additions & 4 deletions math_coding/flows/math_evaluation_flow/line_process.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from promptflow.core import tool
from promptflow import tool


@tool
Expand All @@ -7,18 +7,18 @@ def line_process(groundtruth: str, prediction: str):

if prediction == "JSONDecodeError" or prediction.startswith("Unknown Error:"):
processed_result = -1
return {"output": processed_result}
return {"output": str(processed_result)}

try:
groundtruth = float(groundtruth)
prediction = float(prediction)
except ValueError:
processed_result = -1
return {"output": processed_result}
return {"output": str(processed_result)}

if round(prediction, 2) == round(groundtruth, 2):
processed_result = 1
return {"output": processed_result}
return {"output": str(processed_result)}


if __name__ == "__main__":
Expand Down

0 comments on commit 6b6520f

Please sign in to comment.