diff --git a/src/backend/langflow/interface/custom/custom_component.py b/src/backend/langflow/interface/custom/custom_component.py index 49ac81ab1..b0c4f8752 100644 --- a/src/backend/langflow/interface/custom/custom_component.py +++ b/src/backend/langflow/interface/custom/custom_component.py @@ -95,7 +95,17 @@ class CustomComponent(Component, extra=Extra.allow): build_method = build_methods[0] - return build_method["args"] + args = build_method["args"] + for arg in args: + if arg.get("type") == "prompt": + raise HTTPException( + status_code=400, + detail={ + "error": "Type hint Error", + "traceback": "Prompt type is not supported in the build method. Try using PromptTemplate instead.", + }, + ) + return args @property def get_function_entrypoint_return_type(self) -> List[str]: diff --git a/src/backend/langflow/interface/types.py b/src/backend/langflow/interface/types.py index 25d3e8c8b..6708c11c9 100644 --- a/src/backend/langflow/interface/types.py +++ b/src/backend/langflow/interface/types.py @@ -303,9 +303,9 @@ def build_langchain_template_custom_component(custom_component: CustomComponent) logger.debug("Updated attributes") field_config = build_field_config(custom_component) logger.debug("Built field config") - add_extra_fields( - frontend_node, field_config, custom_component.get_function_entrypoint_args - ) + entrypoint_args = custom_component.get_function_entrypoint_args + + add_extra_fields(frontend_node, field_config, entrypoint_args) logger.debug("Added extra fields") frontend_node = add_code_field( frontend_node, custom_component.code, field_config.get("code", {}) @@ -317,6 +317,8 @@ def build_langchain_template_custom_component(custom_component: CustomComponent) logger.debug("Added base classes") return frontend_node except Exception as exc: + if isinstance(exc, HTTPException): + raise exc raise HTTPException( status_code=400, detail={