Skip to content

armgit / dspy

Public Imported from GitHub
0

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.py
index 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.py
index 567178432..41b450abc 100644
--- a/dspy/clients/lm.py
+++ b/dspy/clients/lm.py
@@ -6,7 +6,7 @@ import uuid
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime
from typing import Any, Dict, List, Literal, Optional
-
+import dspy
import litellm
import 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: