Guardrails Sequence Diagrams#
This guide provides an overview of the process of invoking guardrails.
The following diagram depicts the guardrails process in detail:
The guardrails process has multiple stages that a user message goes through:
Input stage: The user input is first processed by the input rails. The input rails decide if the input is allowed, or whether it should be altered or rejected.
Retrieval stage: If configured to use a knowledge base, relevant context is retrieved and then processed by retrieval rails to validate, filter, and transform the retrieved information before it is injected into prompts.
Dialog stage: If the input is allowed and the configuration contains dialog rails (i.e., at least one user message is defined), then the user message is processed by the dialog flows. This will ultimately result in a bot message.
Execution stage: If custom actions/tools are defined, the system executes them under the control of execution rails, which govern which actions can run and how their inputs/outputs are validated; results may be incorporated into the response.
Output stage: The Output rails decide if the output is allowed, or whether it should be altered or rejected.