Skip to content

Commit

Permalink
Merge pull request #3 from futurice/feature-math-coding
Browse files Browse the repository at this point in the history
update outputs for eval dags
  • Loading branch information
rachhek authored Dec 5, 2024
2 parents cecc76f + f17b2e8 commit 167b179
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion math_coding/experiment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ flow: flows/math_standard_flow
connections:
- name: aoai
connection_type: AzureOpenAIConnection
api_base: https://demoopenaiexamples.openai.azure.com/
api_base: https://edge-10x-ai-services.cognitiveservices.azure.com
api_version: 2023-07-01-preview
api_key: ${api_key}
api_type: azure
Expand Down
5 changes: 4 additions & 1 deletion math_coding/flows/math_evaluation_flow/flow.dag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ inputs:
default: "2"
outputs:
score:
type: string
type: integer
reference: ${line_process.output}
metrics:
type: object
reference: ${aggregate.output}
nodes:
- name: line_process
type: python
Expand Down
9 changes: 4 additions & 5 deletions math_coding/flows/math_evaluation_flow/line_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,23 @@


@tool
def line_process(groundtruth: str, prediction: str) -> int:

def line_process(groundtruth: str, prediction: str):
processed_result = 0

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

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

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


if __name__ == "__main__":
Expand Down

0 comments on commit 167b179

Please sign in to comment.