From 36fdcbfe79c6f52a5b778ee3b50a15d42f9300dd Mon Sep 17 00:00:00 2001 From: Arnav Singhvi Date: Wed, 6 Nov 2024 15:07:21 -0800 Subject: [PATCH 1/2] add flag to suppress litellm logs in dspy.LM --- dspy/clients/lm.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dspy/clients/lm.py b/dspy/clients/lm.py index 567178432a..dc0b7f61d7 100644 --- a/dspy/clients/lm.py +++ b/dspy/clients/lm.py @@ -33,6 +33,7 @@ def __init__( launch_kwargs: Optional[Dict[str, Any]] = None, callbacks: Optional[List[BaseCallback]] = None, num_retries: int = 3, + suppress_debug_info: bool = True, **kwargs, ): """ @@ -61,6 +62,9 @@ def __init__( 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 = 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: From 19b7f06ddb3b0e8a15f9bb48f0649e972fba9217 Mon Sep 17 00:00:00 2001 From: Arnav Singhvi Date: Wed, 6 Nov 2024 17:01:55 -0800 Subject: [PATCH 2/2] add suppress flag to dspy.configure --- dsp/utils/settings.py | 1 + dspy/clients/lm.py | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dsp/utils/settings.py b/dsp/utils/settings.py index ea302f35aa..1fed723683 100644 --- a/dsp/utils/settings.py +++ b/dsp/utils/settings.py @@ -24,6 +24,7 @@ experimental=False, backoff_time=10, callbacks=[], + suppress_debug_info=True, ) diff --git a/dspy/clients/lm.py b/dspy/clients/lm.py index dc0b7f61d7..41b450abc5 100644 --- a/dspy/clients/lm.py +++ b/dspy/clients/lm.py @@ -6,7 +6,7 @@ from concurrent.futures import ThreadPoolExecutor from datetime import datetime from typing import Any, Dict, List, Literal, Optional - +import dspy import litellm import ujson @@ -33,7 +33,6 @@ def __init__( launch_kwargs: Optional[Dict[str, Any]] = None, callbacks: Optional[List[BaseCallback]] = None, num_retries: int = 3, - suppress_debug_info: bool = True, **kwargs, ): """ @@ -63,7 +62,7 @@ def __init__( self.num_retries = num_retries #turned off by default to avoid LiteLLM logging during every LM call - litellm.suppress_debug_info = suppress_debug_info + 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.