Bixby Developer Center

References

advice

optionalvalue required

Specify a statement to test in the named-advice block.

Each named-advice block requires a single advice statement. Bixby evaluates this statement based on the specified match pattern. The developer has access to any concepts that are bound with a variable name in the match pattern. Lazy properties of a concept are resolved prior to the advice evaluation. You can also reference special internal Bixby expression functions and user fields through the $user variable.

Selection Learning performs best when you use an advice function whose return values are monotonically increasing or decreasing for each advise-for and advise-against range, clearly representing how for or against the advice is for the option.

Note

When the options for a strategy do not fall into any of the specified advise-for or advise-against ranges, that strategy will not be used for Selection Learning.

Examples

This example provides advice based on a dropoffETA value that represents the ETA for a ride-sharing drop-off. The example strategy uses a lowerBoundOpen advice strategy, which creates a range of advice scores from the specified value (in this case, 0.0) to the highest possible value. You must assign ranges for the advise-for and advise-against fields, and a weighted function of the field(s) for scoring the option being considered. Any score between 4.9e-324 and 1.7976931348623157e+308, such as Java Double limits, is possible. Bixby's Selection Learning ultimately decides the best value(s) to trust for a decision.

selection-strategy {
id (prefer-dropoff-eta)
match {
RideShare(this)
}
named-advice ("prefer-dropoff-eta") {
advice ("${this.dropoffETA}")
advise-for { lowerBoundOpen (0.0) }
}
}

View master on GitHub

In this example, the productType is an enum, and it is checked against possible values for its symbol. Each eq comparison in the advice statement returns a 1.0 or 0.0 value, and the range in the advise-for block is an exact match for 1.0. This forces Bixby to choose one and only one strategy based on the productType.

selection-strategy {
id (prefer-type)
match {
RideShare (this)
}

named-advice ("prefer-pool") {
advice ("${this.productType eq 'Pool' ? 1.0 : 0.0}")
advise-for { lowerBoundClosed (1.0) upperBoundClosed (1.0) }
}

named-advice ("prefer-standard") {
advice ("${this.productType eq 'Standard' ? 1.0 : 0.0}")
advise-for { lowerBoundClosed (1.0) upperBoundClosed (1.0) }
}

named-advice ("prefer-luxe") {
advice ("${this.productType eq 'Deluxe' ? 1.0 : 0.0}")
advise-for { lowerBoundClosed (1.0) upperBoundClosed (1.0) }
}
}

View master on GitHub

In this example, the named-advice block is providing a boolean score after checking the enum fields, but it could also provide a range.

Note

If you are specifying an optional field in the advice expression, check to make sure that field exists before trying to reference its value!