With Prompt Partials, you can save your commonly used templates (which could be your instruction set, data structure explanation, examples etc.) separately from your prompts and flexibly incorporate them wherever required.
This feature is available on all Portkey plans.
Partials can also serve as a global variable store. You can define common variables that are used across multiple of your prompt templates and can reference or update them easily.
Partials are directly accessible from the Prompts Page in the Prompt Engineering Studio:
You can create a new Partial and use it for any purpose in any of your prompt templates. For example, here’s a prompt partial where we are separately storing the instructions:
Upon saving, each Partial generates a unique ID that you can use inside prompt templates.
Partials also follow the Mustache template engine and let you easily handle data input at runtime by using tags.
Portkey supports {{variable}}
, {{#block}} <string> {{/block}}
, {{^block}}
and other tags.
For more details on template syntax, check out the Prompt Playground documentation which includes a comprehensive guide on how to use tags.
Portkey follows the same Update
& Publish
flow as prompt templates. You can keep updating the partial and save new versions, and choose to send any version to production using the Publish
feature.
All the version history for any partial is available on the right column and any previous version can be restored to be latest
or published
to production easily. For more details on how versioning works, see the Prompt Versioning documentation.
You can call Partials by their ID inside any prompt template by just starting to type {{>
.
Portkey lists all of the available prompt partials with their names to help you easily pick:
When a partial is incorporated in a template, all the variables/blocks defined are also rendered on the Prompt variables section:
When a new Partial version is Published, your partial that is in use in any of the prompt templates also gets automatically updated.
Similar to prompt templates, you can reference specific versions of your prompt partials in the playground. By default, when you use a partial, Portkey uses the published version, but you can specify any version you want.
To reference a specific version of a partial, use the following syntax:
For example:
This will use version 5 of the prompt partial with ID “pp-instructions-123”.
Note: Unlike prompt templates, prompt partials do not support labels
, @latest
, @published
for versioning. You can only reference partials by their version number, @latest
, or the published version.
All the variables/tags defined inside the partial can now be directly called at the time of making a prompts.completions
request:
For more details on integrating prompts in your application, see the Prompt API documentation.
Using Prompt Partials offers several advantages for your AI applications:
For optimal use of Prompt Partials:
Prompt Partials are particularly useful for:
Now that you understand how to use Prompt Partials, explore these related features: