Within text replies you can use params
that are matched by the AI or collected using Any text.
I am going to check the weather for {{country}}
This would result in a response like:
I am going to check the weather for France
Param value
Entity matches could be fuzzy and by default string templates print the value of a matched parameter.
You can also access the match by using {{param.match}}
String templates can be used in different replies like:
- Text replies
- Titles and subtitles of a card
- Button labels.
Param selection
Matched params with the same name are appended and multiple params render as a list within string templates.
You have the option to select the elements that will be rendered. For example to access the last element of the list use param.last.match
:
The first element of the list can be accessed by param.first.match
or param.0.match
.
It also works with the following:
value
: param.first.value
, param.last.value
, param.*any_digit*.value
.
Filters
String templates also support advanced formatting filters. The following are supported:
Category | Filter |
Math | plus, minus, modulo, times, floor, ceil, round, divided_by, abs |
String | append, prepend, capitalize, upcase, downcase, strip,lstrip, rstrip, strip_newlines, split, replace, replace_first, remove, remove_first, truncate, truncatewords |
Date | format like strftime |
For example, a date can be rendered in different formats: