- Where: You define responses as YAML entries (usually in a file such as
domain.ymlorresponses.yml). - Usage: When an assistant flow or pattern decides to “say” something, it references one of these response definitions.
1. Define Your Responses
In CALM, you typically define all your responses under aresponses key in your domain or responses file. Each response name starts with utter_. For example:
domain.yml
- Purpose: Each
utter_response is a distinct piece of content your assistant can send to the user. - Where It’s Used: You can reference the response by its name (e.g.,
utter_greet) in a flow step, or even in a custom action.
2. Use Variables in Responses (Optional)
If you want the assistant to include slot values or other dynamic content, enclose variable names in curly braces:domain.yml
-
How It Works
CALM will replace
{name}with the value of thenameslot (if it’s filled). - From Custom Actions In a custom action, you can pass extra data to fill those variables:
actions.py
3. Provide Response Variations (Optional)
To keep your assistant more engaging, you can define multiple text entries for the sameutter_ response. CALM will randomly pick one at runtime:
domain.yml
4. Add Rich Content (Buttons, Images, etc.)
A response can go beyond text. You can add buttons, images, or custom JSON payloads for richer channels. Buttons Example:domain.yml
/SetSlots()—see the Reference → Responses → Buttons.
Images Example:
domain.yml
5. Use Responses in Flows or Actions
Once your response definitions are in place, you can use them in:- Flows - In a flow step, call the response by name—e.g.,
utter_greet. - Custom Actions - From a custom action, dispatch the response via
dispatcher.utter_message(template="utter_greet").
flows.yml
utter_greet step, it sends one of the variations you defined for utter_greet.