Create Configurations for Dome
Here iss a step-by-step guide that outlines how to setup a config for Dome.Step 1: Choose and Configure Guardrails
Dome provides the following types of Guardrails:- Input Guardrails
- Output Guardrails
- Retrieval Guardrails (coming soon)
- Execution Guardrails (coming soon)
- provide a list of Guards
- specify whether Guards should run serially or in parallel (
run-parallel) - specify whether all Guards should run, or execution should terminate as soon as one Guard is a hit (
early-exit)
Step 2: Assemble and Configure Guards
Guards are groups of Detectors of a particular type that make up a Guardrail. Guards can be named as you like, and are completely user defined. Each Guard must be one of the following types:- Security
- Moderation
- Privacy
- Integrity
- Generic
- specify the type of Guard
- provide a list of Detectors of the same type as the Guard
- specify whether Detectors should run serially or in parallel (
run-parallel) - specify whether all Detectors should run, or execution should terminate as soon as one Detector is a hit (
early-exit)
Step 3: Select and Configure Detectors
Guards are made up of Detectors. To set up your Guards:- Choose specific Detectors from Dome’s growing library
- Configure each Detector with settings like thresholds or context-length.
Example
Configuring Dome via a TOML file
Dome configurations can also be described via .toml files. This enables users to easily save and edit configurations. Instantiating Dome from a TOML file is identical to instantiating it from a dictionary.guardrail that lists out the input and output Guards, and the parallel execution/early termination settings you need. To specify settings for a method in a Guard, use <GUARD_NAME>.<METHOD_NAME>.
When specifying booleans in the TOML, please ensure to use lowercase values (i.e, ‘true’ and ‘false’).
Overall Config Structure
Theguardrail field describes the high level structure of a Dome configuration.
| Attribute | Type | Description |
|---|---|---|
input-guards | List | user-defined list of Guard modules used to scan an input |
input-early-exit | Boolean | determines if the input Guardrail runs in “early-exit” mode, i.e, stop execution as soon as one of the Guards in the input Guardrail has flagged the input. (Default is True) |
input-run-parallel | Boolean | determines whether Guards in the input Guardrail are executed in parallel. (Default is False) |
output-guards | List | user-defined list of Guard modules used to scan an output |
output-early-exit | Boolean | determines if the output Guardrail runs in “early-exit” mode, i.e, stop execution as soon as one of the Guards in the output Guardrail has flagged the input. (Default is True) |
output-run-parallel | Boolean | determines whether Guards in the output Guardrail are executed in parallel. (Default is False) |
guard module has four attributes.
| Attribute | Type | Description |
|---|---|---|
type | Enum | user-defined type of the Guard module, specifying the category of Guards that it holds. Every Guard module can be exactly one of the four currently supported types: security, moderation, privacy, and integrity (experimental) |
methods | List | describes which methods are to be used in the Guard module. Possible methods depend on the type selected, and can be chosen from the list of methods under that type. |
early-exit | Boolean | determines if the Guard runs in “early-exit” mode, i.e, stop execution as soon as one of the methods in Guard has the flagged the query |
run-parallel | Boolean | determines whether methods in the Guard are executed in parallel. (Default is False) |
<MODULE-NAME>.<METHOD-NAME>. In the example above, prompt-injection.security-llm describes the configuration settings for the security-llm method of the prompt-injection Guard module. This configuration scheme lets users create custom settings for different groups and use the same method with different settings in a Guardrail. See the next section for detailed instructions on the options available for each method.