refactor: remove debug prints and add lazy litellm loading verbosity flag

This commit is contained in:
Paul Gauthier 2024-12-04 09:38:20 -08:00 committed by Paul Gauthier (aider)
parent d09d281a8d
commit 974e618541
2 changed files with 5 additions and 2 deletions

View file

@ -12,8 +12,6 @@ if type(__version__) is not str:
__version__ = safe_version + "+type"
else:
try:
print(__version__)
print(safe_version)
if version.parse(__version__) < version.parse(safe_version):
__version__ = safe_version + "+less"
except Exception:

View file

@ -13,6 +13,8 @@ os.environ["LITELLM_MODE"] = "PRODUCTION"
# `import litellm` takes 1.5 seconds, defer it!
VERBOSE = False
class LazyLiteLLM:
_lazy_module = None
@ -27,6 +29,9 @@ class LazyLiteLLM:
if self._lazy_module is not None:
return
if VERBOSE:
print("Loading litellm...")
self._lazy_module = importlib.import_module("litellm")
self._lazy_module.suppress_debug_info = True