DSPy: The framework for programming—not prompting—language models
Python
support activate_assertions
Shangyintca7aad8926ca
diff --git a/dspy/primitives/program.py b/dspy/primitives/program.pyindex 5567ea5ad..1e85a3526 100644--- a/dspy/primitives/program.py+++ b/dspy/primitives/program.py@@ -54,6 +54,14 @@ class Module(BaseModule, metaclass=ProgramMeta):for name, predictor in self.named_predictors():set_attribute_by_name(self, name, func(predictor))return self++ def activate_assertions(self, handler=backtrack_handler, **handler_args):+ """+ Activates assertions for the module.+ The default handler is the backtrack_handler.+ """+ assert_transform_module(self, handler, **handler_args)+ return self# def __deepcopy__(self, memo):# # memo is a dict of id's to copies already made during the current call