🐛 fix(types.py): fix prompt template formatting to handle missing artifacts gracefully
This commit is contained in:
parent
bc69e7ae48
commit
3ce502f298
1 changed files with 5 additions and 1 deletions
|
|
@ -226,7 +226,11 @@ class PromptVertex(Vertex):
|
||||||
# so the prompt format doesn't break
|
# so the prompt format doesn't break
|
||||||
artifacts.pop("handle_keys", None)
|
artifacts.pop("handle_keys", None)
|
||||||
try:
|
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 (
|
return (
|
||||||
template
|
template
|
||||||
if isinstance(template, str)
|
if isinstance(template, str)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue