From 4faa1e7240e0d7ea7725380a79114ec003f7bc5f Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 16 Jun 2023 08:55:38 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20refactor(base.py):=20add=20LLMCh?= =?UTF-8?q?eckerChain=20to=20from=5Fmethod=5Fnodes=20dictionary=20?= =?UTF-8?q?=F0=9F=94=A8=20refactor(chains.py):=20comment=20out=20unused=20?= =?UTF-8?q?code=20block=20The=20`from=5Fmethod=5Fnodes`=20dictionary=20in?= =?UTF-8?q?=20`base.py`=20has=20been=20updated=20to=20include=20the=20`LLM?= =?UTF-8?q?CheckerChain`=20class.=20This=20allows=20the=20`from=5Fllm`=20m?= =?UTF-8?q?ethod=20to=20be=20called=20on=20the=20`LLMCheckerChain`=20class?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code block in `chains.py` that deals with the `PromptTemplate` field type has been commented out as it is currently unused. This is to prevent confusion and to keep the codebase clean. --- src/backend/langflow/interface/chains/base.py | 5 ++++- src/backend/langflow/template/frontend_node/chains.py | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/interface/chains/base.py b/src/backend/langflow/interface/chains/base.py index 63840cf13..ff7e1ee33 100644 --- a/src/backend/langflow/interface/chains/base.py +++ b/src/backend/langflow/interface/chains/base.py @@ -20,7 +20,10 @@ class ChainCreator(LangChainTypeCreator): return ChainFrontendNode #! We need to find a better solution for this - from_method_nodes = {"ConversationalRetrievalChain": "from_llm"} + from_method_nodes = { + "ConversationalRetrievalChain": "from_llm", + "LLMCheckerChain": "from_llm", + } @property def type_to_loader_dict(self) -> Dict: diff --git a/src/backend/langflow/template/frontend_node/chains.py b/src/backend/langflow/template/frontend_node/chains.py index 6b36c28e7..1a1753df3 100644 --- a/src/backend/langflow/template/frontend_node/chains.py +++ b/src/backend/langflow/template/frontend_node/chains.py @@ -33,6 +33,14 @@ class ChainFrontendNode(FrontendNode): field.show = True field.advanced = True + # We should think of a way to deal with this later + # if field.field_type == "PromptTemplate": + # field.field_type = "str" + # field.multiline = True + # field.show = True + # field.advanced = False + # field.value = field.value.template + # Separated for possible future changes if field.name == "prompt" and field.value is None: field.required = True