From 84a971ed0bee7253e18f9cfc54e600eb5972235b Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 4 Aug 2023 00:07:49 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(types.py):=20fix=20prompt=20?= =?UTF-8?q?template=20formatting=20to=20handle=20missing=20artifacts=20gra?= =?UTF-8?q?cefully?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/graph/vertex/types.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/graph/vertex/types.py b/src/backend/langflow/graph/vertex/types.py index 5aee7b14c..b7ac17983 100644 --- a/src/backend/langflow/graph/vertex/types.py +++ b/src/backend/langflow/graph/vertex/types.py @@ -226,7 +226,11 @@ class PromptVertex(Vertex): # so the prompt format doesn't break artifacts.pop("handle_keys", None) try: - template = self._built_object.format(**artifacts) + template = self._built_object.template + for key, value in artifacts.items(): + if value: + replace_key = "{" + key + "}" + template = template.replace(replace_key, value) return ( template if isinstance(template, str)