Bixby Developer Center

Build Conversational Experiences
Guides
References

match-mode

optionalvalue optional

Specify the matching mode for choosing an instantiation strategy.

This key can have one of two values:

  • match-mode (MostSpecific): Use only the instantiation-strategy with the most specific match pattern. This triggers a single instantiation-strategy. This is useful when you want to override a more generic instantiation-strategy. This is the default behavior starting with runtime version 4 or if you specify the use-most-specific-instantiation-strategy runtime flag.
  • match-mode (All): Use all available instantiation strategies. This is useful when you want to add values based on use-case context.

Examples

Example for match-mode (MostSpecific):

The viv.measurement library has an instantiation-strategy for WeightUnit that proposes all possible weight units. The BuildWeight model within it prompts for a WeightUnit with match-mode (MostSpecific):

input (unit) { 
type (WeightUnit)
max (One)
min (Required)
default-init {
with-strategy {
match-mode (MostSpecific)
}
}
}

Accordingly, any capsule using viv.measurement can create an instantiation-strategy with a more specific match pattern to use only a subset of the possible weight units. For example, if you were creating a BMI calculator capsule, you could use the following instantiation strategy to only prompt users to choose between Pound and Kilogram:

instantiation-strategy {
id (instantiate-weight-unit)
match: measurement.WeightUnit {
to-input: measurement.BuildWeight
}
strategy {
intent {
goal-set: measurement.WeightUnit {
measurement.WeightUnit {
name: (Kilogram)
abbreviation: (kg)
}
measurement.WeightUnit {
name: (Pound)
abbreviation: (lb)
}
}
}
}
}

Example for match-mode (All):

You can create separate instantiation strategies based on context. For example, in the viv.geo library, an instantiation strategy exists for geo.searchRadius. In the case of finding airports, you could also create an instantiation strategy to add an additional search radius for airports:

instantiation-strategy {
id (search-radius-for-airports-35-miles)

match {
geo.SearchRadius (default) {
to-input: geo.BuildPointRadius (_) {
to-output: geo.PointRadius (_) {
to-input: geo.BuildPointRadiusSearchRegion (_) {
to-output: geo.SearchRegion (_) {
to-input: FindAirport (_)
}
}
}
}
}
}

strategy {
intent {
goal: geo.SearchRadius {
magnitude {geo.DistanceMagnitude("35")}
unit {geo.DistanceUnit("Miles")}
}
}
}
}

Then when a user searches for an airport, all the instantiation values (1 mile, 5 miles, 10 miles, 25 miles, 50 miles, and 100 miles) as well as 35 miles are proposed to the user. If you decide later that you want to limit the choices for the user, you can change the match pattern in your instantiate-search-radius-airports-35-miles file to be more specific and change the match mode to MostSpecific.