From 5520cb647b0a460daf30cdc02c1841fe9be99efd Mon Sep 17 00:00:00 2001 From: Mike Fortman Date: Thu, 26 Sep 2024 08:31:00 -0500 Subject: [PATCH] refactor: Update parameter order and hide token for DS users (#3920) * Update parameter order and hide token for DS users * cleanup * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- .../components/memories/AstraDBChatMemory.py | 15 +++++++++------ .../langflow/components/vectorstores/AstraDB.py | 15 +++++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/backend/base/langflow/components/memories/AstraDBChatMemory.py b/src/backend/base/langflow/components/memories/AstraDBChatMemory.py index 848895070..7a528a7ba 100644 --- a/src/backend/base/langflow/components/memories/AstraDBChatMemory.py +++ b/src/backend/base/langflow/components/memories/AstraDBChatMemory.py @@ -1,3 +1,5 @@ +import os + from langflow.base.memory.model import LCChatMemoryComponent from langflow.field_typing import BaseChatMessageHistory from langflow.inputs import MessageTextInput, SecretStrInput, StrInput @@ -10,18 +12,13 @@ class AstraDBChatMemory(LCChatMemoryComponent): icon: str = "AstraDB" inputs = [ - StrInput( - name="collection_name", - display_name="Collection Name", - info="The name of the collection within Astra DB where the vectors will be stored.", - required=True, - ), SecretStrInput( name="token", display_name="Astra DB Application Token", info="Authentication token for accessing Astra DB.", value="ASTRA_DB_APPLICATION_TOKEN", required=True, + advanced=os.getenv("ASTRA_ENHANCED", "false").lower() == "true", ), SecretStrInput( name="api_endpoint", @@ -30,6 +27,12 @@ class AstraDBChatMemory(LCChatMemoryComponent): value="ASTRA_DB_API_ENDPOINT", required=True, ), + StrInput( + name="collection_name", + display_name="Collection Name", + info="The name of the collection within Astra DB where the vectors will be stored.", + required=True, + ), StrInput( name="namespace", display_name="Namespace", diff --git a/src/backend/base/langflow/components/vectorstores/AstraDB.py b/src/backend/base/langflow/components/vectorstores/AstraDB.py index b6dc6ebf9..74af16ca4 100644 --- a/src/backend/base/langflow/components/vectorstores/AstraDB.py +++ b/src/backend/base/langflow/components/vectorstores/AstraDB.py @@ -1,3 +1,5 @@ +import os + from loguru import logger from langflow.base.vectorstores.model import LCVectorStoreComponent, check_cached_vector_store @@ -58,18 +60,13 @@ class AstraVectorStoreComponent(LCVectorStoreComponent): } inputs = [ - StrInput( - name="collection_name", - display_name="Collection Name", - info="The name of the collection within Astra DB where the vectors will be stored.", - required=True, - ), SecretStrInput( name="token", display_name="Astra DB Application Token", info="Authentication token for accessing Astra DB.", value="ASTRA_DB_APPLICATION_TOKEN", required=True, + advanced=os.getenv("ASTRA_ENHANCED", "false").lower() == "true", ), SecretStrInput( name="api_endpoint", @@ -78,6 +75,12 @@ class AstraVectorStoreComponent(LCVectorStoreComponent): value="ASTRA_DB_API_ENDPOINT", required=True, ), + StrInput( + name="collection_name", + display_name="Collection Name", + info="The name of the collection within Astra DB where the vectors will be stored.", + required=True, + ), MultilineInput( name="search_input", display_name="Search Input",