Welcome to Portkey Forum

Updated 2 months ago

Can I specify a prompt partial like variables?

At a glance

The community member is asking if there is a way to specify prompt partials like variables, without having to pass the entire partial text. Another community member suggests using {{>>your_partial_variable}}, which will expose a variable named your_partial_variable in the prompts API, allowing the user to explicitly pass any prompt partial ID. The community members discuss the documentation for this feature, and one member notes that the documentation covers the supported tags, including the use case described here.

Useful resources
is there a way to specify prompt partial like variables are specified?

Example:
I have two prompts

You an {{>partital}}

Partial 1
Expert Summary Generator

Partial 2
Expert Web Developer

is there there a way to pass a variable to pick between the two partials without passing the entire partial text?
V
H
7 comments
You can create a partial variable with two >>

Like this: {{>>your_partial_variable}}

This will expose a variable named your_partial_variable in the prompts API where you can explicitly pass any prompt partial id
@Harold Senzei that solves for it right?
is there a place where I can see the complete documentation for different things like this that can be used in a prompt template?

https://portkey.ai/docs/product/prompt-library/prompt-templates#supported-tags
I saw this but the description for {{>>your_partial_variable}} is different and does not mention this use case.
The above document contains everything actually. Maybe my description here on Discord is more lucid than what's in docs - but it also intends to capture the same thing
We support tags from the mustache templating language. What's described here is only what's possible - https://portkey.ai/docs/product/prompt-library/prompt-templates#supported-tags
Add a reply
Sign up and join the conversation on Discord