When working with Promptitude, a prompt management platform, you might often find yourself needing more specific data from a broad variable. This is where sub-variables come into play.
Sub-variables allow you to drill down into the details of a variable, extracting exactly the part you need for your prompt. This guide will walk you through what sub-variables are, how they are structured, and how you can use them effectively in your prompts.
What are Sub-Variables?
Sub-variables are essentially detailed extensions of a main variable. They help specify and extract a particular part of the data held within the main variable. For instance, if you have a variable that contains information about a website, sub-variables let you access specific elements like the content or the URL directly.
Structure of Sub-Variables
Sub-variables are easy to recognize and use. They follow a simple structure:
Start with the original variable name.
Follow it with a dot `.`.
End with the identifier that specifies the part of the variable you need.
Example:
Original Variable: {website}
Sub-Variables: {website.content} for accessing the website's content, {website.url} for the website's URL.
β Availability of Sub-Variables
Currently, sub-variables are available for the following types of variables:
Content Storage: Allows you to access selected chunks of stored content.
Web Page: You can extract specific data like content or URLs.
We are planning to extend this functionality to other types of variables soon, enhancing your ability to quote specific data directly in your prompts.
Type | Variable (e.g.) | Sub-variables | Function |
Content Storage | {content_storage} | {content_storage.query} | Use the variable '.query' to include the search query. |
|
| {content_storage.result} | Use the variable '.result' to include selected chunks of your content that provide context to the prompt. |
Web Page | {web_page} | {web_page.url} | Use the variable '.url' to include the raw URL of your website. |
|
| {web_page.result} | Use the variable '.result' to include the content extracted from your website that will be quoted within the prompt. |
How to Use Sub-Variables
Using sub-variables is straightforward:
Insert the main variable into your prompt.
If sub-variables are available for that type, a list will appear from which you can choose.
Select the appropriate sub-variable that fits your data requirement and insert it into your prompt.
This process helps you tailor the information extracted and displayed in your prompt, making your output more precise and relevant.
π Reminder on Default Results
It's important to remember that each type of variable has a default result:
Web Page: The default is to cite the content extracted from the website.
Content Storage: Displays the selected chunks of your content.
Image: Quotes the raw image for visual identification.
These defaults provide a quick way to use variables if you do not need to specify a sub-variable.
Conclusion
Sub-variables are powerful tools in Promptitude that help you customize and refine the data used in your prompts. By understanding and utilizing sub-variables, you can enhance the accuracy and relevance of your automated content, making your business communications more effective. Whether you're pulling specific content from a webpage or accessing particular segments of stored content, sub-variables give you the flexibility to get exactly what you need.