Migrate to Promptl
Learn how to migrate your prompts to PromptL
Overview
PromptL is the next step in defining prompts for LLMs. It builds on the strengths of the syntax used in Latitude, addressing user feedback to create a simpler, more intuitive, and standardized language for prompt design.
This guide will walk you through the process of migrating your existing prompts to PromptL, highlighting the key changes and improvements.
Why migrate to PromptL?
- Improved Readability: Cleaner syntax for easier maintenance.
- Enhanced Flexibility: More intuitive handling of variables, steps, and references.
- Reduced Conflicts: Eliminates issues with XML tags and legacy quirks.
Migration Steps
Follow these steps to update your prompts to the new PromptL syntax:
Logic blocks
In the new syntax, we no longer use the #
, :
and /
characters to define blocks. Instead, you make these changes in your code:
Conditionals:
{{#if condition}}
->{{if condition}}
{{:else}}
->{{else}}
{{/if}}
->{{endif}}
Loops:
{{#each list as item}}
->{{for item in list}}
{{/each}}
->{{endfor}}
Chain Steps
Now, the contents of steps can be defined directly inside.
References
Referenced documents will not inherit the parent’s variables by default. Now, you need to explicitly pass the variables to the referenced document, using attributes in the tag.
For example, let’s say a referenced prompt was using a variable name
. Now, you need to pass the name
variable to the referenced prompt.
Message Content
The <text>
and <image>
tags have been replaced with <content-text>
and <content-image>
to avoid conflicts with common XML tags used in prompts.
<text>
-><content-text>
<image>
-><content-image>
XML Tags
If you use any XML tags in your prompts, you no longer need to escape them as long as they do not conflict with the PromptL syntax.
\<some-custom-tag>
-><some-custom-tag>
Conclusion
By following these steps, you can easily migrate your existing prompts to the new PromptL syntax.
To learn more about the new syntax capabilities, visit the new syntax documentation.