Module for the configuration of rails.
Configuration of a model used by the rails engine.
Typically, the main model is configured e.g.: { "type": "main", "engine": "openai", "model": "gpt-3.5-turbo-instruct" }
Configuration for instructions in natural language that should be passed to the LLM.
Configuration for documents that should be used for question answering.
Configuration of what sensitive data should be detected.
Template for a message structure.
Configuration for prompts that will be used for a specific task.
check_fields(values)
Configuration of a embedding search provider.
Settings for core internal mechanics.
Configuration of input rails.
Configuration of output rails.
Configuration of retrieval rails.
Configuration for the single LLM call option for topical rails.
Configuration for how the user messages are interpreted.
Configuration of topical rails.
Configuration data for the fact-checking rail.
Configuration data for specific rails that are supported out-of-the-box.
Configuration of specific rails.
Configuration object for the models and the rails.
TODO: add typed config for user_messages, bot_messages, and flows.
Whether the current config supports streaming or not.
Currently, we don't support streaming if there are output rails.
from_content(
colang_content: Optional[str] = None,
yaml_content: Optional[str] = None,
config: Optional[dict] = None
)
Loads a configuration from the provided colang/YAML content/config dict.
from_path(
config_path: str,
test_set_percentage: Optional[float] = 0.0,
test_set: Optional[Dict[str, List]] = {},
max_samples_per_intent: Optional[int] = 0
)
Loads a configuration from a given path.
Supports loading a from a single file, or from a directory.
Also used for testing Guardrails apps, in which case the test_set is randomly created from the intent samples in the config files. In this situation test_set_percentage should be larger than 0.
If we want to limit the number of samples for an intent, set the max_samples_per_intent to a positive number. It is useful for testing apps, but also for limiting the number of samples for an intent in some scenarios. The chosen samples are selected randomly for each intent.
parse_object(obj)
Parses a configuration object from a given dictionary.