mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-07 13:15:00 +00:00
streamlit borks sys.path, causes import("litellm") to load our litellm.py; fix
This commit is contained in:
parent
aaceec1e1f
commit
9d02628cf8
8 changed files with 11 additions and 10 deletions
29
aider/llm.py
Normal file
29
aider/llm.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
import importlib
|
||||
import os
|
||||
import warnings
|
||||
|
||||
warnings.filterwarnings("ignore", category=UserWarning, module="pydantic")
|
||||
|
||||
os.environ["OR_SITE_URL"] = "http://aider.chat"
|
||||
os.environ["OR_APP_NAME"] = "Aider"
|
||||
|
||||
# `import litellm` takes 1.5 seconds, defer it!
|
||||
|
||||
|
||||
class LazyLiteLLM:
|
||||
def __init__(self):
|
||||
self._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
|
||||
|
||||
return getattr(self._lazy_module, name)
|
||||
|
||||
|
||||
litellm = LazyLiteLLM()
|
||||
|
||||
__all__ = [litellm]
|
Loading…
Add table
Add a link
Reference in a new issue