DSPy: The framework for programming—not prompting—language models
Python
add flag to suppress litellm logs in dspy.LM (#1768)
arnavsinghvi1108d9eceb4722
diff --git a/dsp/utils/settings.py b/dsp/utils/settings.pyindex ea302f35a..1fed72368 100644--- a/dsp/utils/settings.py+++ b/dsp/utils/settings.py@@ -24,6 +24,7 @@ DEFAULT_CONFIG = dotdict(experimental=False,backoff_time=10,callbacks=[],+ suppress_debug_info=True,)diff --git a/dspy/clients/lm.py b/dspy/clients/lm.pyindex 567178432..41b450abc 100644--- a/dspy/clients/lm.py+++ b/dspy/clients/lm.py@@ -6,7 +6,7 @@ import uuidfrom concurrent.futures import ThreadPoolExecutorfrom datetime import datetimefrom typing import Any, Dict, List, Literal, Optional-+import dspyimport litellmimport ujson@@ -61,6 +61,9 @@ class LM(BaseLM):self.callbacks = callbacks or []self.num_retries = num_retries+ #turned off by default to avoid LiteLLM logging during every LM call+ litellm.suppress_debug_info = dspy.settings.suppress_debug_info+# TODO: Arbitrary model strings could include the substring "o1-". We# should find a more robust way to check for the "o1-" family models.if "o1-" in model: