From 9a2b8bb7061fe84358ed6d77ba887543f8b673d7 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sun, 28 Jul 2024 17:00:20 -0300 Subject: [PATCH] ensure litellm respects --no-verify-ssl --- aider/llm.py | 21 ++++++++++++--------- aider/main.py | 3 ++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/aider/llm.py b/aider/llm.py index 82f86027a..f65398729 100644 --- a/aider/llm.py +++ b/aider/llm.py @@ -11,19 +11,22 @@ os.environ["OR_APP_NAME"] = "Aider" class LazyLiteLLM: - def __init__(self): - self._lazy_module = None + _lazy_module = None def __getattr__(self, name): - if self._lazy_module is None: - self._lazy_module = importlib.import_module("litellm") - - self._lazy_module.suppress_debug_info = True - self._lazy_module.set_verbose = False - self._lazy_module.drop_params = True - + self._load_litellm() return getattr(self._lazy_module, name) + def _load_litellm(self): + if self._lazy_module is not None: + return + + self._lazy_module = importlib.import_module("litellm") + + self._lazy_module.suppress_debug_info = True + self._lazy_module.set_verbose = False + self._lazy_module.drop_params = True + litellm = LazyLiteLLM() diff --git a/aider/main.py b/aider/main.py index f5e26a863..ea1c622f8 100644 --- a/aider/main.py +++ b/aider/main.py @@ -327,7 +327,8 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F if not args.verify_ssl: import httpx - litellm.client_session = httpx.Client(verify=False) + litellm._load_litellm() + litellm._lazy_module.client_session = httpx.Client(verify=False) if args.dark_mode: args.user_input_color = "#32FF32"