🐛 fix(utils.py): fix import order to avoid import errors

The import order was changed to avoid import errors. The import of langchain was moved to the top of the file to avoid circular import errors.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-25 19:52:49 -03:00
commit a3efa8fe5d

View file

@ -63,11 +63,12 @@ def extract_input_variables_from_prompt(prompt: str) -> list[str]:
def setup_llm_caching():
"""Setup LLM caching."""
import langchain
from langflow.settings import settings
from langflow.interface.importing.utils import import_class
try:
import langchain
from langflow.settings import settings
from langflow.interface.importing.utils import import_class
cache_class = import_class(f"langchain.cache.{settings.cache}")
logger.debug(f"Setting up LLM caching with {cache_class.__name__}")