- A name (e.g.,
phone_numberoruser_name) - A type (e.g.,
text,boolean,categorical, etc.) - (Optionally) a default or initial value
NLUCommandAdapter can issue set slot commands based on extracted entities or intents.
When building flows, you’ll often see collect steps that explicitly request slot values from users. But at any point in the conversation, the LLM can also set or update slots—if you permit it via the slot’s configuration.
How to Write Slots
Slots are defined in your domain file under theslots: key. Each slot entry includes at least:
- The slot name
- The slot type (e.g.,
text,bool,float,categorical,any, etc.) - (Optionally)
mappingsthat specify how the slot should be filled
domain.yml
user_nameis atextslot.- It will be filled by the LLM at any point in the conversation, if the LLM issues the correct
set slotcommand.
domain.yml
NLUCommandAdapter uses the recognized person entity to set the user_name slot. However, if
no value is extracted for the person entity, then the LLM gets a chance to issue a value for it.
You can read more here about how a combination of NLU-based extractors and LLMs can
be used to efficiently extract slots.
Defining Slots in Flows
Within a flow, you often collect slot values using thecollect step:
flows.yml
user_name from the user. If the user’s response is accepted, the LLM issues a set slot command, and user_name gets stored in the conversation state.
How Does Slot Validation Work in CALM?
Slot validation ensures that the values you store are meaningful or properly formatted for your use case. CALM offers three paths for validating slots:- Global slot validation defined on a domain level
refill_utter property.
Example:
domain.yml
-
Lightweight validations with rejections on a flow-level
In the flow’s
collectstep, you can definerejectionsthat check the format or basic conditions on the extracted slot value. If the condition is not met, the assistant rejects the slot value and prompts the user again.
flows.yml
flows.yml