Overview
State machines can also be created using the CSV interface. See CSV Overview.
What Is a State Machine?
In MTP, a state machine is a simplified protocol that maps inputs to one of several predefined states instead of generating open-ended text. This is useful when your model should select from a fixed set of outcomes (for example, intent labels or routing states).
State machine protocols:
- Use a single instruction that chooses between predefined states
- Do not use final tokens (the final is always
<NON>) - Do not allow numeric outputs
Enabling State Machines
State machines are disabled by default. Enable them when creating your protocol:
protocol = mtp.Protocol(
name="my_state_machine",
inputs=1,
encrypt=True,
state_machine=True
)
All CSV protocols are state machines.
Where States Are Stored
When state_machine=True, the template includes:
state_machine: set totruestates: a list of state strings derived from theStateMachineInstructionsamples
See Template for the fields in the template and how they are structured.
Next Steps
- StateMachineInstruction - Define state machine instructions
- StateMachineInput - Define state machine inputs
Databiomes