Config#

relationalai
#class Config(profile: dict)

The Config class is used to provide configurations details to the Model and Provider classes, allowing you to use RAI without a raiconfig.toml file.

Parameters#

NameTypeDescription
profiledictDictionary of RAI configuration details.

Valid Profile Keys#

KeyRequiredDescription
"account"YesThe Snowflake account name to use.
"role"The Snowflake role to use. (Default: "PUBLIC")
"warehouse"YesThe Snowflake warehouse to use.
"rai_app_name"The name of the RAI Native App to use. (Default: "relationalai")
"authenticator"The Snowflake authentication method to use. Must be one of:
  • "snowflake" (Default)
    • Connect via username/password.
    • Requires the "user" and "password" keys.
  • "username_password_mfa"
    • Connect via username/password with multi-factor authentication.
    • Requires the "user", "password", and "passcode" keys.
  • "externalbrowser"
    • Connect in an external browser window by typing your credentials or using single sign-on (SSO).
"user"The Snowflake username to use for authentication.
"password"The Snowflake password to use for authentication.
"passcode"The multi-factor authentication passcode to use for authentication.
"engine"The name of the RAI engine to use. If missing, an engine of size "engine_size" is created automatically using your Snowflake username as the engine name.
"engine_size"The engine size to use when creating an engine. (Default: "HIGHMEM_X64_S")
"debug"Whether to generate debug logs for use with the RAI debugger. (Default: True)
"debug.host"The host name to use for the RAI debugger. (Default: "localhost")
"debug.port"The port number to use for the RAI debugger. (Default: 8080)

Methods#

NameDescriptionReturns
.get()Get a configuration value.Any
.set()Set a configuration value.None

Example#

Use the Config class to use RAI without a raiconfig.toml file, such as in a Snowflake or other cloud notebook environment, or to override configuration details from a raiconfig.toml file:

#import relationalai as rai

# Create a Config object using the default username/password authenticator.
cfg = rai.Config({
    "user": "<SNOWFLAKE_USER>",
    "password": "<SNOWFLAKE_PASSWORD>",
    "account": "<SNOWFLAKE_ACCOUNT>",
    "role": "<SNOWFLAKE_ROLE>",
    "warehouse": "<SNOWFLAKE_WAREHOUSE>",
})
model = rai.Model(config=cfg)

# Create a Config object using the external browser authenticator for SSO.
# Note: This authenticator requires manual input in an external browser window.
cfg = rai.Config({
    "authenticator": "externalbrowser",
    "account": "<SNOWFLAKE_ACCOUNT>",
    "role": "<SNOWFLAKE_ROLE>",
    "warehouse": "<SNOWFLAKE_WAREHOUSE>",
})
model = rai.Model(config=cfg)

See Also#