DSPy: The framework for programming—not prompting—language models
Python
Update program.py
Dilara Soylue428d07f5976
diff --git a/dspy/primitives/program.py b/dspy/primitives/program.pyindex 29af6130c..dbd7b3d38 100644--- a/dspy/primitives/program.py+++ b/dspy/primitives/program.py@@ -49,13 +49,15 @@ class Module(BaseModule, metaclass=ProgramMeta):return [param for _, param in self.named_predictors()]def set_lm(self, lm):- assert dspy.settings.experimental, EXPERIMENTAL_ERR_MSG+ err_msg = "Setting or getting the LM of a program is an experimental feature. Please enable the 'dspy.settings.experimental' flag to use these features."+ assert dspy.settings.experimental, err_msgfor _, param in self.named_predictors():param.lm = lmdef get_lm(self):- assert dspy.settings.experimental, EXPERIMENTAL_ERR_MSG+ err_msg = "Setting or getting the LM of a program is an experimental feature. Please enable the 'dspy.settings.experimental' flag to use these features."+ assert dspy.settings.experimental, err_msgall_used_lms = [param.lm for _, param in self.named_predictors()]