From a3efa8fe5d62cc56935bd36ce22ba0cb9ff52a63 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sun, 25 Jun 2023 19:52:49 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(utils.py):=20fix=20import=20?= =?UTF-8?q?order=20to=20avoid=20import=20errors=20The=20import=20order=20w?= =?UTF-8?q?as=20changed=20to=20avoid=20import=20errors.=20The=20import=20o?= =?UTF-8?q?f=20langchain=20was=20moved=20to=20the=20top=20of=20the=20file?= =?UTF-8?q?=20to=20avoid=20circular=20import=20errors.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/backend/langflow/interface/utils.py b/src/backend/langflow/interface/utils.py index 1a37e89b4..8d45aa1b1 100644 --- a/src/backend/langflow/interface/utils.py +++ b/src/backend/langflow/interface/utils.py @@ -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__}")