Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions dsp/utils/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import threading
from copy import deepcopy
from contextlib import contextmanager
from copy import deepcopy

from dsp.utils.utils import dotdict

Expand All @@ -24,7 +24,6 @@
experimental=False,
backoff_time=10,
callbacks=[],
suppress_debug_info=True,
)


Expand Down
10 changes: 9 additions & 1 deletion dspy/clients/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@
DISK_CACHE_DIR = os.environ.get("DSPY_CACHEDIR") or os.path.join(Path.home(), ".dspy_cache")
litellm.cache = Cache(disk_cache_dir=DISK_CACHE_DIR, type="disk")
litellm.telemetry = False
# Turn off by default to avoid LiteLLM logging during every LM call.
litellm.suppress_debug_info = True

if "LITELLM_LOCAL_MODEL_COST_MAP" not in os.environ:
# accessed at run time by litellm; i.e., fine to keep after import
# Accessed at run time by litellm; i.e., fine to keep after import
os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True"

def enable_litellm_logging():
litellm.suppress_debug_info = False

def disable_litellm_logging():
litellm.suppress_debug_info = True
4 changes: 0 additions & 4 deletions dspy/clients/lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import litellm
import ujson

import dspy
from dspy.adapters.base import Adapter
from dspy.clients.openai import OpenAIProvider
from dspy.clients.provider import Provider, TrainingJob
Expand Down Expand Up @@ -70,9 +69,6 @@ def __init__(
self.num_retries = num_retries
self.finetuning_model = finetuning_model

#turned off by default to avoid LiteLLM logging during every LM call
litellm.suppress_debug_info = dspy.settings.suppress_debug_info

# TODO(bug): 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:
Expand Down
Loading