Scene is the basic unit of control flow when designing a conversation. They can be chained together with other scenes, generate prompts for the end user, and define slots. The scene name is specified in the name of the file.
YAML representation | |
---|---|
onEnter: object ( |
Fields | |
---|---|
onEnter |
Handler to invoke when transitioning into this scene. |
intentEvents[] |
The list of events that trigger based on intents. These events can be triggered at any time after the on_load Handler has been called. Important - these events define the set of intents which are scoped to this scene and will take precedence over any globally defined events that have the same intents or their triggering phrases. Intent names must be unique within a scene. |
conditionalEvents[] |
The list of events to trigger based on conditional statements. These are evaluated after the form has been filled or immediately after on_load if this scene does not have a form (evaluation is only done once). Only the first matching event will be triggered. |
slots[] |
Ordered list of slots. Each slot defines the type of data that it will resolve and configuration to customize the experience of this resolution (e.g. prompts). |
onSlotUpdated |
Handler called when there is a change in state of a slot not caused by updates within another Handler. This allows slots to be invalidated, the scene invalidated or other changes to scene state. |
Slot
Configuration for a slot. Slots are single units of data that can be filled through natural language (ie. intent parameters), session parameters, and other sources.
YAML representation | |
---|---|
name: string type: object ( |
Fields | |
---|---|
name |
Required. Name of the slot. |
type |
Required. Declares the data type of this slot. |
required |
Optional. Indicates whether the slot is required to be filled before advancing. Required slots that are not filled will trigger a customizable prompt to the user. |
promptSettings |
Optional. Registers Prompts for different stages of slot filling. |
commitBehavior |
Optional. Commit behavior associated with the slot. |
config |
Optional. Additional configuration associated with the slot which is used for filling the slot. The format of the config is specific to the type of the slot. Resource references to user or session parameter can be added to this config. This config is needed for filling slots related to transactions and user engagement. Example: For a slot of type actions.type.CompletePurchaseValue, the following config proposes a digital good order with a reference to a client defined session parameter { "@type": "type.googleapis.com/ google.actions.transactions.v3.CompletePurchaseValueSpec", "skuId": { "skuType": "SKU_TYPE_IN_APP", "id": "$session.params.userSelectedSkuId", "packageName": "com.example.company" } } |
defaultValue |
Optional. Configuration to populate a default value for this slot. |
PromptSettings
A single place where slot prompts are defined.
YAML representation | |
---|---|
initialPrompt: object ( |
Fields | |
---|---|
initialPrompt |
Prompt for the slot value itself. Example: "What size did you want?" |
noMatchPrompt1 |
Prompt to give when the user's input does not match the expected value type for the slot for the first time. Example: "Sorry, I didn't get that." |
noMatchPrompt2 |
Prompt to give when the user's input does not match the expected value type for the slot for the second time. Example: "Sorry, I didn't get that." |
noMatchFinalPrompt |
Prompt to give when the user's input does not match the expected value type for the slot for the last time. Example: "Sorry, I didn't get that." |
noInputPrompt1 |
Prompt to give when the user does not provide an input for the first time. Example: "Sorry, I didn't get that." |
noInputPrompt2 |
Prompt to give when the user does not provide an input for the second time. Example: "Sorry, I didn't get that." |
noInputFinalPrompt |
Prompt to give when the user does not provide an input for the last time. Example: "Sorry, I didn't get that." |
CommitBehavior
Message describing the commit behavior associated with the slot after it has been successfully filled.
YAML representation | |
---|---|
writeSessionParam: string |
Fields | |
---|---|
writeSessionParam |
The session parameter to write the slot value after it is filled. Note that nested paths are not currently supported. "$$" is used to write the slot value to a session parameter with same name as the slot. Eg: writeSessionParam = "fruit" corresponds to "$session.params.fruit". writeSessionParam = "ticket" corresponds to "$session.params.ticket". |
DefaultValue
Configuration to populate a default value for this slot.
YAML representation | |
---|---|
sessionParam: string constant: value |
Fields | |
---|---|
sessionParam |
Optional. The session parameter to be used to initialize the slot value, if it has a non-empty value. The type of the value must match the type of the slot. Note that nested paths are not currently supported. Eg: |
constant |
Optional. Constant default value for the slot. This will only be used if a value for this slot was not populated through the |