🔀 chore(utils.py): rename cache variable to CACHE for consistency with other settings

🔀 chore(utils.py): rename `LANGFLOW_LANGCHAIN_CACHE` environment variable to `CACHE` for clarity and consistency
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-08-04 07:49:42 -03:00
commit 956ba45e9b

View file

@ -74,13 +74,12 @@ def setup_llm_caching():
logger.warning(f"Could not setup LLM caching. Error: {exc}")
# TODO Rename this here and in `setup_llm_caching`
def set_langchain_cache(settings):
import langchain
from langflow.interface.importing.utils import import_class
cache_type = os.getenv("LANGFLOW_LANGCHAIN_CACHE")
cache_class = import_class(f"langchain.cache.{cache_type or settings.cache}")
cache_class = import_class(f"langchain.cache.{cache_type or settings.CACHE}")
logger.debug(f"Setting up LLM caching with {cache_class.__name__}")
langchain.llm_cache = cache_class()