Welcome to Portkey Forum

Updated 7 months ago

Saving updated prompts with if conditional variables

πŸ› I am unable to save my updated prompt. The API call to https://albus.portkey.ai/v1/prompts/<prompt-uid> gets stuck in a Pending state if my updated prompt has the if conditional variable from mustache.
Example:
Plain Text
{{#if foo}}

{{foo}}

{{/foo}}
V
b
6 comments
@bhuvansingla For mustache, adding if at the beginning is not required.
Plain Text
{{#foo}}
{{bar}}
{{/foo}

Should work. In your example, the {{#if foo}} tag would have to be closed with {{/if foo}} tag and since it's not closed, the prompt is not getting saved.
cc @Sabbyasachi who can suggest if we should do better error handling for mustache errors
@bhuvansingla please let me know if this solves it!
Ahh sorry, I made a mistake while copying and replacing here but what I was using is:
Plain Text
{{#if foo}}

{{foo}}

{{/if}}


I think it should have been {{/if foo}} as you suggested or no if at all. Let me try this.
That helped! Thanks a lot @Vrushank | Portkey πŸ™Œ
Is the mustache documentation clear? Let me know if you'd like to suggest any changes πŸ™Œ
Add a reply
Sign up and join the conversation on Discord