Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

Fix: 'LM' object has no attribute 'copy'

xiayouran0840f8a51ebd
diff --git a/dspy/clients/lm.py b/dspy/clients/lm.py
index 6ef50cfda..43a8311ce 100644
--- a/dspy/clients/lm.py
+++ b/dspy/clients/lm.py
@@ -65,8 +65,8 @@ class LM:
def copy(self, **kwargs):
"""Returns a copy of the language model with the same parameters."""
- kwargs = {**self.kwargs, **kwargs}
- return self.__class__(model=self.model, **kwargs)
+ kwargs = {**self.__dict__, **kwargs}
+ return self.__class__(**kwargs)
@functools.lru_cache(maxsize=None)