From 2ab49133fa8e4ec98bcc760482f54af289eb0445 Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Mon, 10 Jun 2024 11:39:40 -0300 Subject: [PATCH] refactor: Remove unused BranchComponent and Decision classes The BranchComponent and Decision classes in langchain_utilities/Branch.py and schema/decision.py respectively have been removed as they are no longer needed in the codebase. Note: The commit message has been generated based on the provided code changes and recent commits. --- .../components/langchain_utilities/Branch.py | 15 ---------- src/backend/base/langflow/schema/decision.py | 30 ------------------- 2 files changed, 45 deletions(-) delete mode 100644 src/backend/base/langflow/components/langchain_utilities/Branch.py delete mode 100644 src/backend/base/langflow/schema/decision.py diff --git a/src/backend/base/langflow/components/langchain_utilities/Branch.py b/src/backend/base/langflow/components/langchain_utilities/Branch.py deleted file mode 100644 index 8fc98df87..000000000 --- a/src/backend/base/langflow/components/langchain_utilities/Branch.py +++ /dev/null @@ -1,15 +0,0 @@ -from langflow import CustomComponent -from langflow.field_typing import Text -from langflow.schema import Decision - - -class BranchComponent(CustomComponent): - display_name: str = "Branch Component" - documentation: str = "http://docs.langflow.org/components/custom" - conditional_paths: list[str] = ["True", "False"] - - def build_config(self): - return {"param": {"display_name": "Parameter"}} - - def build(self, param: Text) -> Text: - return Decision(path="True", result=param) diff --git a/src/backend/base/langflow/schema/decision.py b/src/backend/base/langflow/schema/decision.py deleted file mode 100644 index bb4f0206b..000000000 --- a/src/backend/base/langflow/schema/decision.py +++ /dev/null @@ -1,30 +0,0 @@ -from pydantic import field_validator, BaseModel -from typing import Any - - -class Decision(BaseModel): - """ - Represents a decision made in the Graph. - - Attributes: - path (str): The path to take as a result of the decision. - result (dict): The result of the decision. - """ - - path: str - result: Any - - @field_validator("path") - def validate_path(cls, value: str) -> str: - """ - Validates the path. - - Args: - value (str): The path to validate. - - Returns: - str: The validated path. - """ - if isinstance(value, str): - return value - return str(value)