DSPy: The framework for programming—not prompting—language models
Python
change the assert (#7897)
Chen Qianb5584d80fe93
diff --git a/dspy/predict/predict.py b/dspy/predict/predict.pyindex e064a966e..301b68595 100644--- a/dspy/predict/predict.py+++ b/dspy/predict/predict.py@@ -2,12 +2,13 @@ import randomfrom pydantic import BaseModel+from dspy.clients.base_lm import BaseLM+from dspy.clients.lm import LMfrom dspy.predict.parameter import Parameterfrom dspy.primitives.prediction import Predictionfrom dspy.primitives.program import Modulefrom dspy.signatures.signature import ensure_signaturefrom dspy.utils.callback import with_callbacks-from dspy.clients.lm import LMclass Predict(Module, Parameter):@@ -80,7 +81,7 @@ class Predict(Module, Parameter):# Get the right LM to use.lm = kwargs.pop("lm", self.lm) or dspy.settings.lm- assert isinstance(lm, dspy.LM), "No LM is loaded."+ assert isinstance(lm, BaseLM), "No LM is loaded."# If temperature is 0.0 but its n > 1, set temperature to 0.7.temperature = config.get("temperature")