From 71de618519372d8e23de0b527577a25f89e4a735 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 22 Feb 2024 17:24:59 -0300 Subject: [PATCH] Remove base class limitations --- src/backend/langflow/template/frontend_node/base.py | 7 ++----- .../langflow/template/frontend_node/constants.py | 10 ---------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/backend/langflow/template/frontend_node/base.py b/src/backend/langflow/template/frontend_node/base.py index 81144b8f0..8b400b849 100644 --- a/src/backend/langflow/template/frontend_node/base.py +++ b/src/backend/langflow/template/frontend_node/base.py @@ -5,10 +5,7 @@ from typing import ClassVar, Dict, List, Optional, Union from pydantic import BaseModel, Field, field_serializer, model_serializer from langflow.template.field.base import TemplateField -from langflow.template.frontend_node.constants import ( - CLASSES_TO_REMOVE, - FORCE_SHOW_FIELDS, -) +from langflow.template.frontend_node.constants import FORCE_SHOW_FIELDS from langflow.template.frontend_node.formatter import field_formatters from langflow.template.template.base import Template from langflow.utils import constants @@ -88,7 +85,7 @@ class FrontendNode(BaseModel): def process_base_classes(self, base_classes: List[str]) -> List[str]: """Removes unwanted base classes from the list of base classes.""" - return [base_class for base_class in base_classes if base_class not in CLASSES_TO_REMOVE] + return list(set(base_classes)) @field_serializer("display_name") def process_display_name(self, display_name: str) -> str: diff --git a/src/backend/langflow/template/frontend_node/constants.py b/src/backend/langflow/template/frontend_node/constants.py index a213a2744..513ccd1ef 100644 --- a/src/backend/langflow/template/frontend_node/constants.py +++ b/src/backend/langflow/template/frontend_node/constants.py @@ -63,13 +63,3 @@ You can change this to use other APIs like JinaChat, LocalAI and Prem. INPUT_KEY_INFO = """The variable to be used as Chat Input when more than one variable is available.""" OUTPUT_KEY_INFO = """The variable to be used as Chat Output (e.g. answer in a ConversationalRetrievalChain)""" - - -CLASSES_TO_REMOVE = [ - "RunnableSerializable", - "Serializable", - "BaseModel", - "object", - "Runnable", - "Generic", -]