nemoguardrails.rails.llm.config.RailsConfig#

class nemoguardrails.rails.llm.config.RailsConfig[source]#

Bases: BaseModel

Configuration object for the models and the rails.

TODO: add typed config for user_messages, bot_messages, and flows.

models: List[Model]#
user_messages: Dict[str, List[str]]#
bot_messages: Dict[str, List[str]]#
flows: List[Union[Dict, Any]]#
instructions: Optional[List[Instruction]]#
docs: Optional[List[Document]]#
actions_server_url: Optional[str]#
sample_conversation: Optional[str]#
prompts: Optional[List[TaskPrompt]]#
prompting_mode: Optional[str]#
config_path: Optional[str]#
import_paths: Optional[List[str]]#
imported_paths: Optional[Dict[str, str]]#
lowest_temperature: Optional[float]#
enable_multi_step_generation: Optional[bool]#
colang_version: str#
custom_data: Dict#
knowledge_base: KnowledgeBaseConfig#
core: CoreConfig#
rails: Rails#
streaming: bool#

Read-only data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.

msg#

The deprecation message to be emitted.

wrapped_property#

The property instance if the deprecated field is a computed field, or None.

field_name#

The name of the field being deprecated.

enable_rails_exceptions: bool#
passthrough: Optional[bool]#
event_source_uid: str#
tracing: TracingConfig#
classmethod check_model_exists_for_input_rails(values)[source]#

Make sure we have a model for each input rail where one is provided using $model=<model_type>

classmethod check_model_exists_for_output_rails(values)[source]#

Make sure we have a model for each output rail where one is provided using $model=<model_type>

classmethod check_prompt_exist_for_self_check_rails(values)[source]#
classmethod check_output_parser_exists(values)[source]#
classmethod fill_in_default_values_for_v2_x(values)[source]#
classmethod validate_models_api_key_env_var(models)[source]#

Model API Key Env var must be set to make LLM calls

raw_llm_call_action: Optional[str]#
classmethod from_path(config_path)[source]#

Loads a configuration from a given path.

Supports loading a from a single file, or from a directory.

Parameters:

config_path (str)

classmethod from_content(
colang_content=None,
yaml_content=None,
config=None,
)[source]#

Loads a configuration from the provided colang/YAML content/config dict.

Parameters:
  • colang_content (str | None)

  • yaml_content (str | None)

  • config (dict | None)

classmethod parse_object(obj)[source]#

Parses a configuration object from a given dictionary.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].