Skip to content

Commit

Permalink
add: automatic patching for an evaluation metric
Browse files Browse the repository at this point in the history
  • Loading branch information
soumik12345 committed Feb 26, 2025
1 parent 6fc3efa commit d56b673
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion weave/integrations/dspy/dspy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,14 @@ def dspy_postprocess_inputs(inputs: dict[str, Any]) -> dict[str, Any]:
dictified_inputs_self = serialize_dspy_objects(dictified_inputs_self)

if isinstance(inputs["self"], Evaluate):
dictified_inputs_self["devset"] = inputs["self"].devset
if hasattr(inputs["self"], "devset"):
dictified_inputs_self["devset"] = [
serialize_dspy_objects(example) for example in inputs["self"].devset
]

# TODO: This is a hack to make the metric a weave op. Should we do this? Need to ask Ayush tomorrow.
if hasattr(inputs["self"], "metric"):
inputs["self"].metric = weave.op(inputs["self"].metric)

inputs["self"] = dictified_inputs_self

Expand Down

0 comments on commit d56b673

Please sign in to comment.