DSPy: The framework for programming—not prompting—language models
Python
fix assert_transform
Shangyint04580a0bba40
diff --git a/dspy/primitives/assertions.py b/dspy/primitives/assertions.pyindex 0ac3bdb29..2dcae4ff7 100644--- a/dspy/primitives/assertions.py+++ b/dspy/primitives/assertions.py@@ -336,9 +336,9 @@ def assert_transform_module(module)- if all(map(lambda p: isinstance(p, dspy.retry.Retry), module.named_predictors())):+ if all(map(lambda p: isinstance(p[1], dspy.retry.Retry), module.named_predictors())):pass # we already applied the Retry mapping outside- elif all(map(lambda p: not isinstance(p, dspy.retry.Retry), module.named_predictors())):+ elif all(map(lambda p: not isinstance(p[1], dspy.retry.Retry), module.named_predictors())):module.map_named_predictors(dspy.retry.Retry)else:raise RuntimeError("Module has mixed predictors, can't apply Retry mapping.")