Skip to content

armgit / dspy

Public Imported from GitHub
0

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

Python

deepcopy(DEFAULT_CONFIG) to avoid reference

Michael Jonesdafd8ff8f5fa
diff --git a/dsp/utils/settings.py b/dsp/utils/settings.py
index ea02059e4..66fb4b1ab 100644
--- a/dsp/utils/settings.py
+++ b/dsp/utils/settings.py
@@ -1,4 +1,5 @@
-import threading
+import threading\
+from copy import deepcopy
from contextlib import contextmanager
from dsp.utils.utils import dotdict
@@ -46,8 +47,9 @@ class Settings:
# TODO: remove first-class support for re-ranker and potentially combine with RM to form a pipeline of sorts
# eg: RetrieveThenRerankPipeline(RetrievalModel, Reranker)
# downstream operations like dsp.retrieve would use configs from the defined pipeline.
- config = DEFAULT_CONFIG
- cls._instance.__append(config)
+
+ # make a deepcopy of the default config to avoid modifying the default config
+ cls._instance.__append(deepcopy(DEFAULT_CONFIG))
return cls._instance