🐛 fix(types.py): handle case where prompt template is not present in PromptVertex
ℹ️ 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.
This commit is contained in:
parent
9df5e94195
commit
2144e1ec91
1 changed files with 6 additions and 1 deletions
|
|
@ -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 + "}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue