build_prompt
A tool to build a prompt dynamically based on provided templates and values. If a template or value is not provided, the corresponding section will be skipped.
Arguments
Name
Type
Description
Required
prompt_templates
array
A list of objects each containing a template string and a value to insert.
prompt_templates.check_exists
boolean, string, array
If True, the template will be included if the content is not None.
prompt_templates.template
string
The template string to insert the value into. To insert content, use {content}.
prompt_templates.content
prompt, prompt array
The value to insert into the template. If this is an array, the elements will be joined with double newlines.
Returns
Type
Description
prompt
A dynamically constructed prompt based on the provided templates and values.
Example
Last updated