ensure litellm respects --no-verify-ssl

This commit is contained in:
Paul Gauthier 2024-07-28 17:00:20 -03:00
parent 15faf69173
commit 9a2b8bb706
2 changed files with 14 additions and 10 deletions

View file

@ -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()

View file

@ -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"