Skip to content

armgit / dspy

Public Imported from GitHub
0

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

Python

lm.py: disable telemetry in litellm

jacka707b0004a53
diff --git a/dspy/clients/lm.py b/dspy/clients/lm.py
index ccc730f2b..e00dd7f5e 100644
--- a/dspy/clients/lm.py
+++ b/dspy/clients/lm.py
@@ -7,7 +7,10 @@ try:
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=UserWarning)
- import litellm
+ if "LITELLM_LOCAL_MODEL_COST_MAP" not in os.environ:
+ os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True"
+ import litellm
+ litellm.telemetry = False
from litellm.caching import Cache
disk_cache_dir = os.environ.get('DSPY_CACHEDIR') or os.path.join(Path.home(), '.dspy_cache')