Skip to content

refactor: add required=True to necessary components #5679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class AddContentToPage(LCToolComponent):
name="block_id",
display_name="Page/Block ID",
info="The ID of the page/block to add the content.",
required=True,
),
SecretStrInput(
name="notion_secret",
Expand Down
1 change: 1 addition & 0 deletions src/backend/base/langflow/components/Notion/create_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class NotionPageCreator(LCToolComponent):
name="database_id",
display_name="Database ID",
info="The ID of the Notion database.",
required=True,
),
SecretStrInput(
name="notion_secret",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class NotionDatabaseProperties(LCToolComponent):
name="database_id",
display_name="Database ID",
info="The ID of the Notion database.",
required=True,
),
SecretStrInput(
name="notion_secret",
Expand Down
1 change: 1 addition & 0 deletions src/backend/base/langflow/components/Notion/list_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class NotionListPages(LCToolComponent):
name="database_id",
display_name="Database ID",
info="The ID of the Notion database to query.",
required=True,
),
MultilineInput(
name="query_json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class NotionPageContent(LCToolComponent):
name="page_id",
display_name="Page ID",
info="The ID of the Notion page to retrieve.",
required=True,
),
SecretStrInput(
name="notion_secret",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class NotionPageUpdate(LCToolComponent):
name="page_id",
display_name="Page ID",
info="The ID of the Notion page to update.",
required=True,
),
MultilineInput(
name="properties",
Expand Down
1 change: 1 addition & 0 deletions src/backend/base/langflow/components/data/directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class DirectoryComponent(Component):
info="Path to the directory to load files from. Defaults to current directory ('.')",
value=".",
tool_mode=True,
required=True,
),
MultiselectInput(
name="types",
Expand Down
1 change: 1 addition & 0 deletions src/backend/base/langflow/components/inputs/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class ChatInput(ChatComponent):
value="",
info="Message to be passed as input.",
input_types=[],
required=True,
),
BoolInput(
name="should_store_message",
Expand Down
1 change: 1 addition & 0 deletions src/backend/base/langflow/components/inputs/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class TextInputComponent(TextComponent):
name="input_value",
display_name="Text",
info="Text to be passed as input.",
required=True,
),
]
outputs = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AlterMetadataComponent(Component):
name="input_value",
display_name="Input",
info="Object(s) to which Metadata should be added",
required=False,
required=True,
input_types=["Message", "Data"],
is_list=True,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ class CombineTextComponent(Component):
name="text1",
display_name="First Text",
info="The first text input to concatenate.",
required=True,
),
MessageTextInput(
name="text2",
display_name="Second Text",
info="The second text input to concatenate.",
required=True,
),
MessageTextInput(
name="delimiter",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ class DataFrameOperationsComponent(Component):
name="df",
display_name="DataFrame",
info="The input DataFrame to operate on.",
required=True,
),
DropdownInput(
name="operation",
display_name="Operation",
options=OPERATION_CHOICES,
info="Select the DataFrame operation to perform.",
real_time_refresh=True,
required=True,
),
StrInput(
name="column_name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ class FilterDataComponent(Component):
name="data",
display_name="Data",
info="Data object to filter.",
required=True,
),
MessageTextInput(
name="filter_criteria",
display_name="Filter Criteria",
info="List of keys to filter by.",
is_list=True,
required=True,
),
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,28 @@ class DataFilterComponent(Component):
name = "FilterDataValues"

inputs = [
DataInput(name="input_data", display_name="Input Data", info="The list of data items to filter.", is_list=True),
DataInput(
name="input_data",
display_name="Input Data",
info="The list of data items to filter.",
is_list=True,
required=True,
),
MessageTextInput(
name="filter_key",
display_name="Filter Key",
info="The key to filter on (e.g., 'route').",
value="route",
value="",
input_types=["Data"],
required=True,
),
MessageTextInput(
name="filter_value",
display_name="Filter Value",
info="The value to filter by (e.g., 'CMIP').",
value="CMIP",
value="",
input_types=["Data"],
required=True,
),
DropdownInput(
name="operator",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class MessageToDataComponent(Component):
name="message",
display_name="Message",
info="The Message object to convert to a Data object",
required=True,
),
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class UpdateDataComponent(Component):
display_name="Data",
info="The record to update.",
is_list=True, # Changed to True to handle list of Data objects
required=True,
),
IntInput(
name="number_of_fields",
Expand Down
2 changes: 1 addition & 1 deletion src/backend/base/langflow/components/prompts/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PromptComponent(Component):
name = "Prompt"

inputs = [
PromptInput(name="template", display_name="Template"),
PromptInput(name="template", display_name="Template", required=True),
MessageTextInput(
name="tool_placeholder",
display_name="Tool Placeholder",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class AstraDBVectorStoreComponent(LCVectorStoreComponent):
display_name="Embedding Model",
input_types=["Embeddings"],
info="Allows an embedding model configuration.",
required=True,
),
*base_inputs,
IntInput(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class AstraDBGraphVectorStoreComponent(LCVectorStoreComponent):
display_name="Embedding Model",
input_types=["Embeddings"],
info="Allows an embedding model configuration.",
required=True,
),
DropdownInput(
name="metric",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class CassandraVectorStoreComponent(LCVectorStoreComponent):
list=True,
),
*LCVectorStoreComponent.inputs,
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"]),
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"], required=True),
IntInput(
name="number_of_results",
display_name="Number of Results",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class CassandraGraphVectorStoreComponent(LCVectorStoreComponent):
list=True,
),
*LCVectorStoreComponent.inputs,
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"]),
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"], required=True),
IntInput(
name="number_of_results",
display_name="Number of Results",
Expand Down
4 changes: 3 additions & 1 deletion src/backend/base/langflow/components/vectorstores/chroma.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ class ChromaVectorStoreComponent(LCVectorStoreComponent):
name="collection_name",
display_name="Collection Name",
value="langflow",
required=True,
),
StrInput(
name="persist_directory",
display_name="Persist Directory",
required=True,
),
*LCVectorStoreComponent.inputs,
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"]),
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"], required=True),
StrInput(
name="chroma_server_cors_allow_origins",
display_name="Server CORS Allow Origins",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ClickhouseVectorStoreComponent(LCVectorStoreComponent):
StrInput(name="index_param", display_name="Param of the index", value="'L2Distance',100", advanced=True),
DictInput(name="index_query_params", display_name="index query params", advanced=True),
*LCVectorStoreComponent.inputs,
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"]),
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"], required=True),
IntInput(
name="number_of_results",
display_name="Number of Results",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CouchbaseVectorStoreComponent(LCVectorStoreComponent):
StrInput(name="collection_name", display_name="Collection Name", required=True),
StrInput(name="index_name", display_name="Index Name", required=True),
*LCVectorStoreComponent.inputs,
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"]),
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"], required=True),
IntInput(
name="number_of_results",
display_name="Number of Results",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class ElasticsearchVectorStoreComponent(LCVectorStoreComponent):
name="username",
display_name="Username",
value="",
required=True,
advanced=False,
info=(
"Elasticsearch username (e.g., 'elastic'). "
Expand All @@ -58,6 +59,7 @@ class ElasticsearchVectorStoreComponent(LCVectorStoreComponent):
name="password",
display_name="Password",
value="",
required=True,
advanced=False,
info=(
"Elasticsearch password for the specified user. "
Expand All @@ -68,6 +70,7 @@ class ElasticsearchVectorStoreComponent(LCVectorStoreComponent):
name="embedding",
display_name="Embedding",
input_types=["Embeddings"],
required=True,
),
DropdownInput(
name="search_type",
Expand Down
4 changes: 3 additions & 1 deletion src/backend/base/langflow/components/vectorstores/faiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ class FaissVectorStoreComponent(LCVectorStoreComponent):
name="index_name",
display_name="Index Name",
value="langflow_index",
required=True,
),
StrInput(
name="persist_directory",
display_name="Persist Directory",
info="Path to save the FAISS index. It will be relative to where Langflow is running.",
required=True,
),
*LCVectorStoreComponent.inputs,
BoolInput(
Expand All @@ -34,7 +36,7 @@ class FaissVectorStoreComponent(LCVectorStoreComponent):
advanced=True,
value=True,
),
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"]),
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"], required=True),
IntInput(
name="number_of_results",
display_name="Number of Results",
Expand Down
1 change: 1 addition & 0 deletions src/backend/base/langflow/components/vectorstores/hcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class HCDVectorStoreComponent(LCVectorStoreComponent):
name="embedding",
display_name="Embedding or Astra Vectorize",
input_types=["Embeddings", "dict"],
required=True,
# TODO: This should be optional, but need to refactor langchain-astradb first.
info="Allows either an embedding model or an Astra Vectorize configuration.",
),
Expand Down
6 changes: 4 additions & 2 deletions src/backend/base/langflow/components/vectorstores/milvus.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,20 @@ class MilvusVectorStoreComponent(LCVectorStoreComponent):
icon = "Milvus"

inputs = [
StrInput(name="collection_name", display_name="Collection Name", value="langflow"),
StrInput(name="collection_name", display_name="Collection Name", value="langflow", required=True),
StrInput(name="collection_description", display_name="Collection Description", value=""),
StrInput(
name="uri",
display_name="Connection URI",
value="http://localhost:19530",
required=True,
),
SecretStrInput(
name="password",
display_name="Token",
value="",
info="Ignore this field if no token is required to make connection.",
required=True,
),
DictInput(name="connection_args", display_name="Other Connection Arguments", advanced=True),
StrInput(name="primary_field", display_name="Primary Field Name", value="pk"),
Expand All @@ -51,7 +53,7 @@ class MilvusVectorStoreComponent(LCVectorStoreComponent):
BoolInput(name="drop_old", display_name="Drop Old Collection", value=False, advanced=True),
FloatInput(name="timeout", display_name="Timeout", advanced=True),
*LCVectorStoreComponent.inputs,
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"]),
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"], required=True),
IntInput(
name="number_of_results",
display_name="Number of Results",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MongoVectorStoreComponent(LCVectorStoreComponent):
StrInput(name="collection_name", display_name="Collection Name", required=True),
StrInput(name="index_name", display_name="Index Name", required=True),
*LCVectorStoreComponent.inputs,
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"]),
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"], required=True),
IntInput(
name="number_of_results",
display_name="Number of Results",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ class OpenSearchVectorStoreComponent(LCVectorStoreComponent):
display_name="OpenSearch URL",
value="http://localhost:9200",
info="URL for OpenSearch cluster (e.g. https://192.168.1.1:9200).",
required=True,
),
StrInput(
name="index_name",
display_name="Index Name",
value="langflow",
info="The index name where the vectors will be stored in OpenSearch cluster.",
required=True,
),
*LCVectorStoreComponent.inputs,
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"]),
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"], required=True),
DropdownInput(
name="search_type",
display_name="Search Type",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class PineconeVectorStoreComponent(LCVectorStoreComponent):
advanced=True,
),
*LCVectorStoreComponent.inputs,
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"]),
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"], required=True),
IntInput(
name="number_of_results",
display_name="Number of Results",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class QdrantVectorStoreComponent(LCVectorStoreComponent):
StrInput(name="content_payload_key", display_name="Content Payload Key", value="page_content", advanced=True),
StrInput(name="metadata_payload_key", display_name="Metadata Payload Key", value="metadata", advanced=True),
*LCVectorStoreComponent.inputs,
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"]),
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"], required=True),
IntInput(
name="number_of_results",
display_name="Number of Results",
Expand Down
2 changes: 1 addition & 1 deletion src/backend/base/langflow/components/vectorstores/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class RedisVectorStoreComponent(LCVectorStoreComponent):
value=4,
advanced=True,
),
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"]),
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"], required=True),
]

@check_cached_vector_store
Expand Down
Loading
Loading