A shortcut for specifying an input with plan-behavior(Never)
. Use computed-input
when you need a safe way to add inputs to your function implementation that can be derived from other inputs, or when you want to store an intermediate value for use by other inputs, intents, or effects later in the action definition. In the latter case, you might want to hide the computed-input
from the function implementation via Hidden
). You should use computed-inputs
because it does not have a side effect on the planner.
action (<name>) {
collect {
computed-input (<type>)
}
}
action (GetDateInterval) {
description (Prompt user to enter a date interval)
type (Constructor)
collect {
computed-input (dateInterval) {
type (DateInterval)
min (Required)
compute {
intent {
goal { @prompt-behavior(AlwaysElicitation) DateInterval }
}
}
}
}
output (DateInterval) {
evaluate { $expr(dateInterval) }
}
}
action (SelectItem) {
type (Search)
collect {
input (searchTerm) {
type (SearchTerm)
min (Optional)
}
input (order) {
description (order that is being updated)
type (Order)
min (Required)
hidden
}
computed-input (items) {
description (The items to select from, should be more than one)
type (Item)
min (Optional) //this is optional as the shopping cart may be empty
max (Many)
compute {
if (exists(order.items)) {
intent {
goal: Item
value: $expr(order.items)
}
}
}
}
}
output (SelectedItem) {
throws {
error(MultipleMatches) {
property (matches) {
type (Item)
max (Many)
}
on-catch {
//prompt for matched items, clear searchTerm
prompt (items) {
required-value (true)
single-value (true)
candidates (matches)
}
}
}
}
on-empty {
//prompt for items, clear searchTerm
ordered-effects {
drop (searchTerm)
prompt (items) {
required-value (true)
single-value (true)
candidates (items)
}
}
}
}
}
compute required | Specifies an intent, describing the computation that should derive the input's value |
type required | Specifies the variable type |
default-select optional | Enables selection rules in your action using the with-rule key and selection learning with the with-learning key |
description optional | Adds text describing the variable, which is useful for documenting models |
hidden optional | Hide this input from function implementations |
max optional | Maximum cardinality of the input (One or Many) |
min optional | Minimum cardinality of the input (Optional or Required) |
order optional | Defines an explicit order in which to collect the inputs |
prompt-behavior optional | A behavioral mode that modifies how the system will prompt on the input or at a prompt during plan execution time |
validate optional | Lists validation rules for an input or variable |