From 2144e1ec91d88118d6553269a95ef8f8a0af63b7 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 14 Aug 2023 17:16:54 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(types.py):=20handle=20case?= =?UTF-8?q?=20where=20prompt=20template=20is=20not=20present=20in=20Prompt?= =?UTF-8?q?Vertex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ℹ️ The code was modified to handle a case where the `template` attribute is not present in the `PromptVertex` class. If the `template` attribute is not found, the code checks if the `prompt` attribute is present and uses its `template` attribute instead. This change ensures that the code does not break when the `template` attribute is missing. --- src/backend/langflow/graph/vertex/types.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/graph/vertex/types.py b/src/backend/langflow/graph/vertex/types.py index b7ac17983..9a2dc21c5 100644 --- a/src/backend/langflow/graph/vertex/types.py +++ b/src/backend/langflow/graph/vertex/types.py @@ -226,7 +226,12 @@ class PromptVertex(Vertex): # so the prompt format doesn't break artifacts.pop("handle_keys", None) try: - template = self._built_object.template + if not hasattr(self._built_object, "template") and hasattr( + self._built_object, "prompt" + ): + template = self._built_object.prompt.template + else: + template = self._built_object.template for key, value in artifacts.items(): if value: replace_key = "{" + key + "}"