Call Another Template

{{ maistro|template: "templateName" }}

Imports the contents of templateName into the current environment.

Example 1:

Given an example template, neuralseek_updates:

Based on the changelogs found here:
{{ web|url:"https://documentation.neuralseek.com/changelog/" }}
list the items for the latest month.
{{ LLM }}

Simply using {{ maistro|template: "neuralseek_updates" }} will produce the sample result.

Example 2:

To pass parameters to mAIstro templates, you simply define the variables in your current environment.

Given an example template, neuralseek_updates:

Based on the changelogs found here:
{{ web|url:"<< name:'url' >>" }}
list the items for the latest month.
{{ LLM }}

To pass the url variable to the template:

{{ variable  | name: "url" | value: "https://documentation.neuralseek.com/changelog/" }}

{{ maistro|template: "neuralseek_updates" }}

This allows templates to be brought into current context, effectively "splicing" the contents into the desired context.

Set Variable

Creates or sets a variable that can be used later in the NTL expression. For example,

34=>{{ variable | name:"age" }}
or
{{ variable  | name: "age" | value: "34" }}

Parameters:

  • Name: The name of the variable to set.
  • Value: The optional (override) value to set to the variable.

No Returns.

Use Variable

Syntax to use / expand a variable into the environment.

<< name: variableName, prompt: true >>

Parameters:

  • Name: The name of the variable
  • Prompt: If set to true, the UI will prompt for the value for this variable. If set to false, the UI will avoid prompting for this variable.

Returns:

  • The contents of the variable.

Note about variables

When the variable is NOT found but used in << >> notation, the variable is considered as user input, and mAIstro will prompt for the value prior to evaluation. For example, if you have << name: new >> or << name: new, prompt: true >> and there is not such thing as {{ variable|name: "new" }} in the expression, mAIstro will ask for it like this:

set_params

Stop

Stops all further processing. Full stop.

{{ stop }}

Loops: Start, End, Break

Start Loop

Denotes the beginning of a loop, and declares the maximum number of loops to perform.

{{ startLoop  | count: "3" }}

End Loop

Denotes the end of a loop. This does not stop the loop, but rather sends the execution back to the beginning if the total number of loops have not yet been reached.

{{ endLoop }}

Break Loop

Stops a loop early. Useful with the condition node.

{{ breakLoop }}

Loop Example

{{ variable  | name: "count" | mode: "" | value: "0" }}
{{ startLoop  | count: "5" }}
{{ math  | equation: "<< name: count >> + 1" }}=>{{ variable  | name: "count" }}
{{ endLoop  }}
The count is now: << name: count >>

Will Yield:

The count is now: 6

Note

The number of loops assigned in startLoop is the number of additional times the nodes will be executed. As seen above, the middle node (math) will be executed a total of 6 times - Once to begin, and then 5 more times (the number of loops set).

Condition

The Conditional function allows us to direct the flow of operations.

{{ condition | value: "1 == 1" }}

Parameters:

  • Value: The conditional / logic to evaluate. Supports the following:
    • Common comparison operators like ==, !=, >, <, >=, <=, <>.
    • Basic math operators like *, ^, /, -, +.
    • Basic functions: IF(), NOT(), AND(,,,), OR(,,,)
    • String comparisons: Using single-quoted strings, you can compare

Returns: No returns, however:

  • A condition that evaluates to 'true' will continue the horizontal chain.
  • A condition that evaluates to 'false' will stop the horizontal chain from executing and continue to the next flow step.

Example 1:

{{ condition  | value: "1 == 1" }}=>This is true!

Will yield the output text: This is true!

Example 2:

{{ condition  | value: "OR(1==1,2==3)" }}=>This is true!

Will continue the chain and yield the output text: This is true!, where:

{{ condition  | value: "OR(1==2,2==3)" }}=>This is true!

Will stop the chain and yield no output, as the chain was blocked with a false condition.

Example 3:

{{ condition  | value: "'name' == 'name'" }}=>This is true!

Will yield the output text: This is true!

For more: See the "Conditional Logic" Example Template for a working example on routing chains based on a variable value:

Conditional mAIstro Example


Ⓒ 2024 NeuralSeek, all rights reserved.