module nemoguardrails.rails.llm.config
#
Module for the configuration of rails.
class Model
#
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” }
class Instruction
#
Configuration for instructions in natural language that should be passed to the LLM.
class Document
#
Configuration for documents that should be used for question answering.
class SensitiveDataDetectionOptions
#
class SensitiveDataDetection
#
Configuration of what sensitive data should be detected.
class MessageTemplate
#
Template for a message structure.
class TaskPrompt
#
Configuration for prompts that will be used for a specific task.
classmethod TaskPrompt.check_fields
#
check_fields(values)
class EmbeddingSearchProvider
#
Configuration of a embedding search provider.
class KnowledgeBaseConfig
#
class CoreConfig
#
Settings for core internal mechanics.
class InputRails
#
Configuration of input rails.
class OutputRails
#
Configuration of output rails.
class RetrievalRails
#
Configuration of retrieval rails.
class SingleCallConfig
#
Configuration for the single LLM call option for topical rails.
class UserMessagesConfig
#
Configuration for how the user messages are interpreted.
class DialogRails
#
Configuration of topical rails.
class FactCheckingRailConfig
#
Configuration data for the fact-checking rail.
class RailsConfigData
#
Configuration data for specific rails that are supported out-of-the-box.
class Rails
#
Configuration of specific rails.
class RailsConfig
#
Configuration object for the models and the rails.
TODO: add typed config for user_messages, bot_messages, and flows.
property RailsConfig.streaming_supported#
Whether the current config supports streaming or not.
Currently, we don’t support streaming if there are output rails.
method RailsConfig.from_content
#
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.
method RailsConfig.from_path
#
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.
classmethod RailsConfig.parse_object
#
parse_object(obj)
Parses a configuration object from a given dictionary.