From 56b23c4a1dac5d07c103e20e5aa47c5957fde078 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 6 Jul 2023 15:22:47 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20chore(types.py):=20add=20missing?= =?UTF-8?q?=20return=20statement=20in=20=5Fbuilt=5Fobject=5Frepr=20method?= =?UTF-8?q?=20of=20PromptVertex=20=F0=9F=93=9D=20docs(types.py):=20improve?= =?UTF-8?q?=20readability=20and=20add=20clarity=20to=20the=20=5Fbuilt=5Fob?= =?UTF-8?q?ject=5Frepr=20method=20of=20PromptVertex=20The=20=5Fbuilt=5Fobj?= =?UTF-8?q?ect=5Frepr=20method=20of=20PromptVertex=20was=20missing=20a=20r?= =?UTF-8?q?eturn=20statement=20when=20the=20condition=20in=20the=20if=20st?= =?UTF-8?q?atement=20was=20not=20met.=20This=20commit=20adds=20the=20missi?= =?UTF-8?q?ng=20return=20statement=20to=20ensure=20the=20method=20always?= =?UTF-8?q?=20returns=20a=20value.=20Additionally,=20the=20commit=20improv?= =?UTF-8?q?es=20the=20documentation=20of=20the=20method=20to=20provide=20b?= =?UTF-8?q?etter=20readability=20and=20clarity.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/graph/vertex/types.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/backend/langflow/graph/vertex/types.py b/src/backend/langflow/graph/vertex/types.py index b3accd02d..b48733e84 100644 --- a/src/backend/langflow/graph/vertex/types.py +++ b/src/backend/langflow/graph/vertex/types.py @@ -201,6 +201,15 @@ class PromptVertex(Vertex): self._build() return self._built_object + def _built_object_repr(self): + if self.artifacts and hasattr(self._built_object, "format"): + # We'll build the prompt with the artifacts + # to show the user what the prompt looks like + # with the variables filled in + return self._built_object.format(**self.artifacts) + else: + super()._built_object_repr() + class OutputParserVertex(Vertex): def __init__(self, data: Dict):