Instantiation Strategies inform Bixby's execution about where to get missing values that are required in order to fulfill a user request. During execution, an action input can require one or more values that the user request or executing context has not specified. Each matching instantiation-strategy
is evaluated and can provide one or more values to planning. If after all strategies have been evaluated, more than one instantiated option exists, it is passed to Selection Learning for the system to decide which one, if any, should be automatically selected for the user. For more information, see Default Values and the Selection Learning sample capsule.
You define each instantiation-strategy
in a *.strategy.bxb
file, with the file in your resources/base
folder.
There is no learning for Instantiation Strategies. If they match, are valid, and provide results, they are passed on to execution, where they are merged and used in other Bixby learning subsystems for processing.
If no instantiation strategy is provided, or the provided strategies do not resolve to any values, the user is prompted for the missing information.
The instantiation strategy below provides a set of possible tip percentage values when required. For example, if calculating a total bill requires a tip percentage and the user hasn't specified one in the request this, along with other matching strategies, provide execution with possible tip percentages for the request:
// resources/strategies/dflt-tip-percent.strategy.bxb
instantiation-strategy {
id (init-tip-percent-from-dflt-enum)
match {
gratuity.TipPercent (this)
}
strategy {
intent {
value: gratuity.TipPercent(10)
value: gratuity.TipPercent(15)
value: gratuity.TipPercent(18)
value: gratuity.TipPercent(20)
value: gratuity.TipPercent(25)
goal: gratuity.TipPercent
}
}
}
Since this strategy's intent
specifies more than one tip percentage, it is guaranteed to invoke Bixby's Selection Learning to help pick one automatically.
More than one instantiation strategy might be available for a given input. By default, Bixby will try all instantiation strategies for required inputs. You can change this to only use the strategy with the most specific match pattern by using default-init.with-strategy
or compute.with-strategy
(for computed inputs).
description required | Optional description of the strategy for documentation purposes |
id required | Identifier that is unique for a given capsule |
match optional | Allows the developer to define the specific scenarios that a Instantiation Strategy should apply |
strategy optional | A strategy block encompasses the intent that sources the instantiated value(s) |