🐛 fix(types.py): add a check for None before checking if the built object has a "format" attribute to prevent potential AttributeError

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-07-08 14:57:22 -03:00
commit 6aac7e8e80

View file

@ -211,7 +211,11 @@ class PromptVertex(Vertex):
return self._built_object
def _built_object_repr(self):
if self.artifacts and hasattr(self._built_object, "format"):
if (
self.artifacts
and self._built_object is not None
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