From 0fc4d9e29cb438af01085e9b770c66ab925cdcbd Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Wed, 9 Aug 2023 19:49:27 -0700 Subject: [PATCH] clean up print statements --- litellm/utils.py | 14 +++++++++----- pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/litellm/utils.py b/litellm/utils.py index 1c5fda15d8..08210a2b95 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -48,20 +48,24 @@ def install_and_import(package: str): required = [req for req in pkg_resources.get_distribution(package).requires()] # Print the version of the package - print(f"{package} version: {dist.version}") + # print(f"{package} version: {dist.version}") # Check if there are dependencies if required: for req in required: install_and_import(req.project_name) else: - print(f"{package} has been successfully installed with no dependencies.") - + print_verbose(f"{package} has been successfully installed with no dependencies.") + + except (ModuleNotFoundError, ImportError): + print_verbose(f"{package} is not installed. Installing...") + subprocess.call([sys.executable, "-m", "pip", "install", package]) + globals()[package] = importlib.import_module(package) except (DistributionNotFound, ImportError): - print(f"{package} is not installed. Installing...") + print_verbose(f"{package} is not installed. Installing...") subprocess.call([sys.executable, "-m", "pip", "install", package]) globals()[package] = importlib.import_module(package) except VersionConflict as vc: - print(f"Detected version conflict for {package}. Upgrading...") + print_verbose(f"Detected version conflict for {package}. Upgrading...") subprocess.call([sys.executable, "-m", "pip", "install", "--upgrade", package]) globals()[package] = importlib.import_module(package) finally: diff --git a/pyproject.toml b/pyproject.toml index 3538b8161f..e2fbea95b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "litellm" -version = "0.1.371" +version = "0.1.372" description = "Library to easily interface with LLM API providers" authors = ["BerriAI"] license = "MIT License"