stanfordnlp / dspy

DSPy: The framework for programming—not prompting—foundation models
https://dspy-docs.vercel.app/
MIT License
13.82k stars 1.06k forks source link

Update evaluate.py-Fix ZeroDivisionError in metric calculation #1193

Closed leegang closed 1 week ago

leegang commented 1 week ago

Fix ZeroDivisionError in metric calculation

This commit prevents crashes due to division by zero and provides meaningful feedback when no examples are processed, enhancing the overall stability of the evaluation functionality.

XenonMolecule commented 1 week ago

This was auto-closed by merging #1194. It could be useful to throw a more helpful exception than divide by zero here, though, just so it's more obvious what is going wrong. Perhaps we could make a change with a more descriptive exception but still throw an exception when running on an empty devset.