diff --git a/src/backend/langflow/__main__.py b/src/backend/langflow/__main__.py index fa167f188..d5472c1c9 100644 --- a/src/backend/langflow/__main__.py +++ b/src/backend/langflow/__main__.py @@ -22,7 +22,7 @@ app = typer.Typer() def update_settings( config: str, - cache: str, + cache: Optional[str] = None, dev: bool = False, remove_api_keys: bool = False, components_path: Optional[Path] = None, @@ -117,10 +117,10 @@ def serve( log_file: Path = typer.Option( "logs/langflow.log", help="Path to the log file.", envvar="LANGFLOW_LOG_FILE" ), - cache: str = typer.Option( + cache: Optional[str] = typer.Option( envvar="LANGFLOW_LANGCHAIN_CACHE", help="Type of cache to use. (InMemoryCache, SQLiteCache)", - default="SQLiteCache", + default=None, ), jcloud: bool = typer.Option(False, help="Deploy on Jina AI Cloud"), dev: bool = typer.Option(False, help="Run in development mode (may contain bugs)"), diff --git a/src/backend/langflow/interface/utils.py b/src/backend/langflow/interface/utils.py index d6c7b9023..e14d0e464 100644 --- a/src/backend/langflow/interface/utils.py +++ b/src/backend/langflow/interface/utils.py @@ -78,9 +78,16 @@ 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}") + if cache_type := os.getenv("LANGFLOW_LANGCHAIN_CACHE"): + try: + 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() - logger.info(f"LLM caching setup with {cache_class.__name__}") + logger.debug(f"Setting up LLM caching with {cache_class.__name__}") + langchain.llm_cache = cache_class() + logger.info(f"LLM caching setup with {cache_class.__name__}") + except ImportError: + logger.warning(f"Could not import {cache_type}. ") + else: + logger.info("No LLM cache set.") diff --git a/src/backend/langflow/services/plugins/langfuse.py b/src/backend/langflow/services/plugins/langfuse.py index 98375a549..4dbd90a3d 100644 --- a/src/backend/langflow/services/plugins/langfuse.py +++ b/src/backend/langflow/services/plugins/langfuse.py @@ -16,7 +16,7 @@ class LangfuseInstance: @classmethod def create(cls): - logger.debug("Creating Langfuse instance") + logger.debug("Checking Langfuse credentials") from langflow.settings import settings from langfuse import Langfuse # type: ignore diff --git a/src/backend/langflow/settings.py b/src/backend/langflow/settings.py index abb391446..e28e90eea 100644 --- a/src/backend/langflow/settings.py +++ b/src/backend/langflow/settings.py @@ -32,7 +32,7 @@ class Settings(BaseSettings): DEV: bool = False DATABASE_URL: Optional[str] = None - CACHE: str = "InMemoryCache" + CACHE: Optional[str] = None REMOVE_API_KEYS: bool = False COMPONENTS_PATH: List[str] = [] diff --git a/src/frontend/src/components/inputListComponent/index.tsx b/src/frontend/src/components/inputListComponent/index.tsx index a1f58789f..f415e4dbb 100644 --- a/src/frontend/src/components/inputListComponent/index.tsx +++ b/src/frontend/src/components/inputListComponent/index.tsx @@ -19,7 +19,9 @@ export default function InputListComponent({ }, [disabled]); // @TODO Recursive Character Text Splitter - the value might be in string format, whereas the InputListComponent specifically requires an array format. To ensure smooth operation and prevent potential errors, it's crucial that we handle the conversion from a string to an array with the string as its element. - typeof value === 'string' ? value = [value] : value = value; + if (typeof value === "string") { + value = [value]; + } return (