DSPy: The framework for programming—not prompting—language models
Python
rename decorator
manishshettym5983c909f0f5
diff --git a/dspy/primitives/assertions.py b/dspy/primitives/assertions.pyindex c4b65ffc2..957066921 100644--- a/dspy/primitives/assertions.py+++ b/dspy/primitives/assertions.py@@ -40,7 +40,7 @@ class Assert:raise ValueError("Assertion function should always return [bool]")-def assert_latest_feedback_transform(max_backtracks=2):+def assert_backtrack_policy(max_backtracks=2):"""Decorator that defines the backtracking policy for assertions.current policy: re-run the latest predictor up to `max_backtracks` times,diff --git a/dspy/primitives/program.py b/dspy/primitives/program.pyindex 3704b2dd1..5a8a0fbc9 100644--- a/dspy/primitives/program.py+++ b/dspy/primitives/program.py@@ -15,9 +15,7 @@ class ProgramMeta(type):# return obj-class Module(BaseModule, metaclass=ProgramMeta):-def _base_init(self):self._compiled = False@@ -28,7 +26,7 @@ class Module(BaseModule, metaclass=ProgramMeta):if getattr(self, "forward", False) and not getattr(self.forward, "_decorated", False):- wrapped_forward = assert_latest_feedback_transform()(self.forward)+ wrapped_forward = assert_backtrack_policy()(self.forward)return wrapped_forward(*args, **kwargs)else:return self.forward(*args, **kwargs)