Smarter Settings

Smarter common configuration module.

smarter_settings is one instance of Settings, which combines a Pydantic model per topic. Each topic’s module, in the package smarter.common.conf.settings, holds its fields, their validators, and the properties derived from them. A new setting goes into the topic it belongs to.

pydantic model smarter.common.conf.Settings[source]

See: https://docs.pydantic.dev/latest/concepts/pydantic_settings/.

Smarter derived settings. This is intended to be instantiated as an immutable singleton object called smarter_settings. smarter_settings contains superseding, validated, and derived settings values for the platform.

This class implements a consistent set of rules for initializing configuration values from multiple sources, including environment variables, .env file, and default values defined in this class. It additionally ensures that all configuration values are strongly typed and validated.

Where applicable, smarter_settings supersede Django settings values. That is, smarter_settings should be used in preference to Django settings wherever possible. Django settings are initialized from smarter_settings values where applicable.

Notes:

  • smarter_settings values are immutable after instantiation.

  • Every property/attribute in smarter_settings has a value. If a value is None then it is intentionally None.

  • Sensitive values are stored as pydantic SecretStr types.

  • smarter_settings values are initialized according to the following prioritization sequence:
    1. constructor. This is discouraged. prefer to use .env file or environment variables.

    2. environment variables, and the .env file’s: SMARTER_<FIELD>.

    3. each field’s default, on the field.

  • The dump property returns a dictionary of all configuration values.

  • smarter_settings values should be accessed via the smarter_settings singleton instance when possible.

Show JSON schema
{
   "title": "Settings",
   "description": "See: https://docs.pydantic.dev/latest/concepts/pydantic_settings/.\n\nSmarter derived settings. This is intended to be instantiated as\nan immutable singleton object called `smarter_settings`. smarter_settings\ncontains superseding, validated, and derived settings values for the platform.\n\nThis class implements a consistent set of rules for initializing configuration\nvalues from multiple sources, including environment variables, `.env` file,\nand default values defined in this class. It additionally ensures that all\nconfiguration values are strongly typed and validated.\n\nWhere applicable, smarter_settings supersede Django settings values. That is,\nsmarter_settings should be used in preference to Django settings wherever\npossible. Django settings are initialized from smarter_settings values where\napplicable.\n\nNotes:\n-----------------\n- smarter_settings values are immutable after instantiation.\n- Every property/attribute in smarter_settings has a value.\n  If a value is None then it is intentionally None.\n- Sensitive values are stored as pydantic SecretStr types.\n- smarter_settings values are initialized according to the following prioritization sequence:\n    1. constructor. This is discouraged. prefer to use .env file or environment variables.\n    2. environment variables, and the `.env` file's: ``SMARTER_<FIELD>``.\n    3. each field's default, on the field.\n- The dump property returns a dictionary of all configuration values.\n- smarter_settings values should be accessed via the smarter_settings singleton instance when possible.",
   "type": "object",
   "properties": {
      "app_llmclient_tasks_create_dns_record": {
         "default": true,
         "description": "True if DNS records should be created for llmclient tasks.",
         "title": "LLMClient Tasks Create DNS Record",
         "type": "boolean"
      },
      "app_llmclient_tasks_create_ingress_manifest": {
         "default": true,
         "description": "True if ingress manifests should be created for llmclient tasks.",
         "title": "LLMClient Tasks Create Ingress Manifest",
         "type": "boolean"
      },
      "app_llmclient_tasks_default_ttl": {
         "default": 600,
         "description": "Default TTL (time to live) for DNS records created in AWS Route53 during LLMClient deployment.",
         "minimum": 0,
         "title": "LLMClient Tasks Default TTL",
         "type": "integer"
      },
      "app_llmclient_tasks_celery_max_retries": {
         "default": 3,
         "description": "Maximum number of retries for llmclient tasks in Celery.",
         "exclusiveMinimum": 0,
         "title": "LLMClient Tasks Celery Max Retries",
         "type": "integer"
      },
      "app_llmclient_tasks_celery_retry_backoff": {
         "default": true,
         "description": "If True, enables exponential backoff for Celery task retries related to LLMClient deployment and management",
         "title": "LLMClient Tasks Celery Retry Backoff",
         "type": "boolean"
      },
      "app_llmclient_tasks_celery_task_queue": {
         "default": "default_celery_task_queue",
         "description": "The Celery task queue name for llmclient tasks.",
         "title": "LLMClient Tasks Celery Task Queue",
         "type": "string"
      },
      "app_infrastructure_tasks_celery_task_queue": {
         "default": "infrastructure_celery_task_queue",
         "description": "The Celery task queue name for infrastructure tasks, which deploy, verify and destroy cloud, Kubernetes and DNS resources.",
         "title": "Infrastructure Tasks Celery Task Queue",
         "type": "string"
      },
      "app_tools_tasks_celery_task_queue": {
         "default": "tools_celery_task_queue",
         "description": "The Celery task queue name for LLM tool calls, which the tool worker, smarter-worker-tools, runs.",
         "title": "Tools Tasks Celery Task Queue",
         "type": "string"
      },
      "app_extensions_tasks_celery_task_queue": {
         "default": "extensions_celery_task_queue",
         "description": "The Celery task queue name for Extensions' tool calls, which smarter-worker-extensions runs.",
         "title": "Extensions Tasks Celery Task Queue",
         "type": "string"
      },
      "app_tools_worker_queue": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The queue that this tool worker consumes: the tools or the Extensions queue. Empty in every other process.",
         "title": "Tool Worker Queue"
      },
      "app_llmtool_tool_runner": {
         "default": "in_process",
         "description": "Where LLM tool calls run: in_process, in the app's own process, or remote, in the tool worker, smarter-worker-tools, which holds no credentials.",
         "enum": [
            "in_process",
            "remote"
         ],
         "title": "LLM Tool Runner",
         "type": "string"
      },
      "platform_admin_username": {
         "default": "admin",
         "description": "The username of the platform's superuser, which manage.py initialize_platform creates.",
         "examples": [
            "admin"
         ],
         "title": "Administrator Username",
         "type": "string"
      },
      "platform_admin_password": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The password of the platform's superuser, which manage.py initialize_platform creates.",
         "examples": [
            "your-admin-password"
         ],
         "title": "Administrator Password"
      },
      "platform_fernet_encryption_key": {
         "description": "The Fernet encryption key used for encrypting Smarter Secrets data.",
         "examples": [
            "gAAAAABh..."
         ],
         "format": "password",
         "title": "Fernet Encryption Key",
         "type": "string",
         "writeOnly": true
      },
      "platform_internal_ip_prefixes": {
         "default": [
            "192.168."
         ],
         "description": "A list of internal IP prefixes used for security and middleware features.",
         "examples": [
            [
               "192.168.",
               "10.0."
            ]
         ],
         "items": {
            "type": "string"
         },
         "title": "Internal IP Prefixes",
         "type": "array"
      },
      "DJANGO_SECRET_KEY": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "description": "The Django secret key for cryptographic signing.",
         "examples": [
            "your-django-secret-key"
         ],
         "title": "Django Secret Key"
      },
      "app_api_throttle_rate_anon": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "120/minute",
         "description": "The request rate limit of each anonymous client, by IP address. None disables it.",
         "examples": [
            "120/minute",
            "10/second",
            "none"
         ],
         "title": "Anonymous Throttle Rate"
      },
      "app_api_throttle_rate_user": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "600/minute",
         "description": "The request rate limit of each authenticated user. None disables it.",
         "examples": [
            "600/minute",
            "20/second",
            "none"
         ],
         "title": "User Throttle Rate"
      },
      "max_tool_rounds": {
         "default": 5,
         "description": "The most requests of one prompt that offer the LLM its tools.",
         "minimum": 1,
         "title": "Max Tool Rounds",
         "type": "integer"
      },
      "prompt_history_max_age": {
         "default": 90,
         "description": "Days to keep chat sessions and their prompt history before they are deleted.",
         "minimum": 1,
         "title": "Prompt History Max Age",
         "type": "integer"
      },
      "app_llmtool_plugin_max_data_results": {
         "default": 50,
         "description": "A global maximum number of data row results that can be returned by any Smarter plugin.",
         "exclusiveMinimum": 0,
         "title": "Plugin Max Data Results",
         "type": "integer"
      },
      "app_llmtool_extension_registry_url": {
         "default": "https://smarter-sh.github.io/extensions-registry/index.json",
         "description": "The url of the Smarter Extension registry's signed index, index.json.",
         "examples": [
            "https://smarter-sh.github.io/extensions-registry/index.json"
         ],
         "title": "Extension Registry URL",
         "type": "string"
      },
      "app_llmtool_extension_registry_public_key": {
         "default": "",
         "description": "The base64 Ed25519 public key that verifies the extension registry's index. Empty disables the registry.",
         "title": "Extension Registry Public Key",
         "type": "string"
      },
      "app_mcpserver_rate_limit": {
         "default": 1200,
         "description": "The maximum number of requests per minute that one client IP address may send to the MCPServer's endpoints. 0 disables the limit.",
         "minimum": 0,
         "title": "MCP Server Rate Limit",
         "type": "integer"
      },
      "llm_default_provider": {
         "default": "openai",
         "description": "The default LLM provider to use for language model interactions.",
         "examples": [
            "openai",
            "anthropic",
            "gemini",
            "llama"
         ],
         "title": "Default LLM Provider",
         "type": "string"
      },
      "llm_default_model": {
         "default": "gpt-6-luna",
         "description": "The default model of the default LLM provider, for plugins whose manifests don't name one.",
         "examples": [
            "gpt-6-luna"
         ],
         "title": "Default LLM Model",
         "type": "string"
      },
      "llm_default_system_role": {
         "default": "You are a helpful llmclient. When given the opportunity to utilize function calling, you should always do so. This will allow you to provide the best possible responses to the user. If you are unable to provide a response, you should prompt the user for more information. If you are still unable to provide a response, you should inform the user that you are unable to help them at this time.",
         "description": "The default system role prompt to use for language model interactions.",
         "examples": [
            "You are a helpful llmclient..."
         ],
         "title": "Default LLM System Role",
         "type": "string"
      },
      "llm_default_temperature": {
         "default": 1.0,
         "description": "The default temperature to use for language model interactions.",
         "examples": [
            0.0,
            0.5,
            1.0
         ],
         "title": "Default LLM Temperature",
         "type": "number"
      },
      "llm_default_max_tokens": {
         "default": 2048,
         "description": "The default maximum number of tokens to generate for language model interactions.",
         "examples": [
            256,
            512,
            1024,
            2048
         ],
         "minimum": 1,
         "title": "Default LLM Max Tokens",
         "type": "integer"
      },
      "prompt_threads": {
         "default": 32,
         "description": "The threads in each web server process that run streamed chat prompts.",
         "minimum": 1,
         "title": "Prompt Threads",
         "type": "integer"
      },
      "account_manager_api_key": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The platform's key for Account Manager's subscription status api, which multitenant authentication sends as 'Authorization: Platform <key>'. Masked by pydantic SecretStr.",
         "examples": [
            "the key that Account Manager's create_platform_api_key command printed"
         ],
         "title": "Account Manager API Key"
      },
      "GITHUB_TOKEN": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The platform's GitHub token, from GITHUB_TOKEN, for the GitHub REST api requests that retrieve remote SkillPlugin skills, and that open the bug reports of the platform's staff. Masked by pydantic SecretStr.",
         "examples": [
            "ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
         ],
         "title": "GitHub Token"
      },
      "subsystem_social_auth_google_oauth2_key": {
         "default": "**********",
         "description": "The OAuth2 key for Google social authentication. Masked by pydantic SecretStr.",
         "examples": [
            "your-google-oauth2-key"
         ],
         "format": "password",
         "title": "Google OAuth2 Key",
         "type": "string",
         "writeOnly": true
      },
      "subsystem_social_auth_google_oauth2_secret": {
         "default": "**********",
         "description": "The OAuth2 secret for Google social authentication. Masked by pydantic SecretStr.",
         "examples": [
            "your-google-oauth2-secret"
         ],
         "format": "password",
         "title": "Google OAuth2 Secret",
         "type": "string",
         "writeOnly": true
      },
      "subsystem_social_auth_github_key": {
         "default": "**********",
         "description": "The OAuth2 key for GitHub social authentication. Masked by pydantic SecretStr.",
         "examples": [
            "your-github-oauth2-key"
         ],
         "format": "password",
         "title": "GitHub OAuth2 Key",
         "type": "string",
         "writeOnly": true
      },
      "subsystem_social_auth_github_secret": {
         "default": "**********",
         "description": "The OAuth2 secret for GitHub social authentication. Masked by pydantic SecretStr.",
         "examples": [
            "your-github-oauth2-secret"
         ],
         "format": "password",
         "title": "GitHub OAuth2 Secret",
         "type": "string",
         "writeOnly": true
      },
      "subsystem_social_auth_linkedin_oauth2_key": {
         "default": "**********",
         "description": "The OAuth2 key for LinkedIn social authentication. Masked by pydantic SecretStr.",
         "examples": [
            "your-linkedin-oauth2-key"
         ],
         "format": "password",
         "title": "LinkedIn OAuth2 Key",
         "type": "string",
         "writeOnly": true
      },
      "subsystem_social_auth_linkedin_oauth2_secret": {
         "default": "**********",
         "description": "The OAuth2 secret for LinkedIn social authentication. Masked by pydantic SecretStr.",
         "examples": [
            "your-linkedin-oauth2-secret"
         ],
         "format": "password",
         "title": "LinkedIn OAuth2 Secret",
         "type": "string",
         "writeOnly": true
      },
      "subsystem_slack_bot_token": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "A Slack app's bot token, xoxb-..., which the platform posts its Kubernetes jobs' logs to Slack with. Masked by pydantic SecretStr.",
         "examples": [
            "xoxb-xxxxxxxxxxxx-xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx"
         ],
         "title": "Slack Bot Token"
      },
      "subsystem_slack_app_token": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The Slack bot's app-level token, xapp-..., for Socket Mode. Only the Slack bot holds it.",
         "examples": [
            "xapp-1-xxxxxxxxxxx-xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
         ],
         "title": "Slack App Token"
      },
      "stripe_live_secret_key": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": "**********",
         "description": "DEPRECATED: The secret key for Stripe live environment.",
         "examples": [
            "sk_live_xxxxxxxxxxxxxxxxxxxxxxxx"
         ],
         "title": "Stripe Live Secret Key"
      },
      "stripe_test_secret_key": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": "**********",
         "description": "DEPRECATED: The secret key for Stripe test environment.",
         "examples": [
            "sk_test_xxxxxxxxxxxxxxxxxxxxxxxx"
         ],
         "title": "Stripe Test Secret Key"
      },
      "debug_mode": {
         "default": false,
         "description": "True if debug mode is enabled. This enables verbose logging and other debug features.",
         "title": "Debug Mode",
         "type": "boolean"
      },
      "dump_defaults": {
         "default": false,
         "description": "True if default values should be dumped for debugging purposes.",
         "title": "Dump Defaults",
         "type": "boolean"
      },
      "developer_mode": {
         "default": false,
         "description": "True if developer mode is enabled. Used as a means to configure a production Docker container to run locally for student use.",
         "title": "Developer Mode",
         "type": "boolean"
      },
      "app_dashboard_manifest_dropzone_enable": {
         "default": true,
         "description": "True if the file drop zone feature is enabled based on the current environment.",
         "title": "Enable File Drop Zone",
         "type": "boolean"
      },
      "app_connection_enable": {
         "default": true,
         "description": "True if the web console serves the Connection pages. Set with SMARTER_APP_CONNECTION_ENABLE.",
         "title": "Enable Connection",
         "type": "boolean"
      },
      "app_guardrail_enable": {
         "default": true,
         "description": "True if the web console serves the Guardrail pages. Set with SMARTER_APP_GUARDRAIL_ENABLE.",
         "title": "Enable Guardrail",
         "type": "boolean"
      },
      "app_llmclient_enable": {
         "default": true,
         "description": "True if the web console serves the LLMClient pages. Set with SMARTER_APP_LLMCLIENT_ENABLE.",
         "title": "Enable LLMClient",
         "type": "boolean"
      },
      "app_llmhost_enable": {
         "default": true,
         "description": "True if the web console serves the LLMHost pages. Set with SMARTER_APP_LLMHOST_ENABLE.",
         "title": "Enable LLMHost",
         "type": "boolean"
      },
      "app_llmtool_enable": {
         "default": true,
         "description": "True if the web console serves the LLMTool and Extension pages. Set with SMARTER_APP_LLMTOOL_ENABLE.",
         "title": "Enable LLMTool",
         "type": "boolean"
      },
      "app_mcpclient_enable": {
         "default": true,
         "description": "True if the web console serves the MCPClient pages. Set with SMARTER_APP_MCPCLIENT_ENABLE.",
         "title": "Enable MCPClient",
         "type": "boolean"
      },
      "app_orchestrator_enable": {
         "default": true,
         "description": "True if the web console serves the Orchestrator pages. Set with SMARTER_APP_ORCHESTRATOR_ENABLE.",
         "title": "Enable Orchestrator",
         "type": "boolean"
      },
      "app_provider_enable": {
         "default": true,
         "description": "True if the web console serves the Provider pages. Set with SMARTER_APP_PROVIDER_ENABLE.",
         "title": "Enable Provider",
         "type": "boolean"
      },
      "app_secret_enable": {
         "default": true,
         "description": "True if the web console serves the Secret pages. Set with SMARTER_APP_SECRET_ENABLE.",
         "title": "Enable Secret",
         "type": "boolean"
      },
      "app_vectorsearch_enable": {
         "default": true,
         "description": "True if the web console serves the VectorSearch pages. Set with SMARTER_APP_VECTORSEARCH_ENABLE.",
         "title": "Enable VectorSearch",
         "type": "boolean"
      },
      "app_vectorstore_enable": {
         "default": true,
         "description": "True if the vectorstore feature is enabled based on the current environment.",
         "title": "Enable Vectorstore",
         "type": "boolean"
      },
      "app_proxy_enable": {
         "default": true,
         "description": "True if the proxy feature is enabled based on the current environment.",
         "title": "Enable Proxy",
         "type": "boolean"
      },
      "app_dashboard_server_logs_enable": {
         "default": true,
         "description": "True if the terminal app feature is enabled based on the current environment.",
         "title": "Enabled Terminal App",
         "type": "boolean"
      },
      "app_dashboard_web_console_terminal_enable": {
         "default": false,
         "description": "True if superusers can open a bash shell inside the server's container from the web console's Terminal page. Off by default.",
         "title": "Enable Web Console Terminal",
         "type": "boolean"
      },
      "platform_static_files_on_cdn": {
         "default": false,
         "description": "True if the platform's static files, the web console's scripts among them, are uploaded to the environment's S3 bucket and served from its CDN. Off by default: the server serves them.",
         "title": "Static Files on the CDN",
         "type": "boolean"
      },
      "app_dashboard_passthrough_prompt_enable": {
         "default": true,
         "description": "True if the passthrough prompt feature is enabled based on the current environment.",
         "title": "Enable Passthrough Prompt",
         "type": "boolean"
      },
      "log_level": {
         "default": 20,
         "description": "The platform's Python logging level: DEBUG, INFO, WARNING, ERROR or CRITICAL, or its number. Set with SMARTER_LOG_LEVEL.",
         "examples": [
            "DEBUG",
            "INFO",
            30
         ],
         "maximum": 50,
         "minimum": 0,
         "title": "Logging Level",
         "type": "integer"
      },
      "verbose_logging": {
         "default": false,
         "description": "Whether to enable verbose logging for debugging purposes.",
         "examples": [
            true,
            false
         ],
         "title": "Verbose Logging",
         "type": "boolean"
      },
      "subsystem_sql_root_username": {
         "default": "root",
         "description": "The database server's administrator, whom manage.py load_from_github --run_scripts passes to a repository's scripts.",
         "examples": [
            "root"
         ],
         "title": "MySQL Root Username",
         "type": "string"
      },
      "subsystem_sql_root_password": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The password of the database server's administrator, sql_root_username.",
         "examples": [
            "your-root-password"
         ],
         "title": "MySQL Root Password"
      },
      "subsystem_sql_backup_password": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The password of the read-only account that the nightly database backup dumps the database as.",
         "examples": [
            "your-backup-password"
         ],
         "title": "MySQL Backup Password"
      },
      "subsystem_sql_host": {
         "default": "smarter-mariadb",
         "description": "The host name of the platform's database server.",
         "examples": [
            "smarter-mariadb",
            "mysql.example.com"
         ],
         "title": "MySQL Host",
         "type": "string"
      },
      "subsystem_sql_port": {
         "default": 3306,
         "description": "The TCP port of the platform's database server.",
         "examples": [
            3306
         ],
         "maximum": 65535,
         "minimum": 1,
         "title": "MySQL Port",
         "type": "integer"
      },
      "subsystem_sql_database": {
         "default": "smarter",
         "description": "The name of the platform's database.",
         "examples": [
            "smarter"
         ],
         "title": "MySQL Database",
         "type": "string"
      },
      "subsystem_sql_user": {
         "default": "smarter",
         "description": "The database user that the platform connects as.",
         "examples": [
            "smarter"
         ],
         "title": "MySQL User",
         "type": "string"
      },
      "subsystem_sql_password": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The password of sql_user, the database user that the platform connects as.",
         "examples": [
            "your-database-password"
         ],
         "title": "MySQL Password"
      },
      "database_read_timeout": {
         "default": 0,
         "description": "The seconds that a query of the platform's database may wait for the server's reply before it fails. 0 for no timeout.",
         "minimum": 0,
         "title": "Database Read Timeout",
         "type": "integer"
      },
      "database_unavailable": {
         "default": false,
         "description": "True in a process that has no platform database: the tool worker. Waffle switches are then off, without a query.",
         "title": "Database Unavailable",
         "type": "boolean"
      },
      "subsystem_redis_username": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The Redis ACL user that this process authenticates as, or empty for Redis's default user.",
         "examples": [
            "tools"
         ],
         "title": "Redis Username"
      },
      "subsystem_redis_password": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The password of the platform's Redis: the Celery broker, the cache and the sessions.",
         "examples": [
            "your-redis-password"
         ],
         "title": "Redis Password"
      },
      "subsystem_cache_expiration": {
         "default": 60,
         "description": "The cache expiration time in seconds for cached data.",
         "exclusiveMinimum": 0,
         "title": "Cache Expiration",
         "type": "integer"
      },
      "subsystem_cache_chat_expiration": {
         "default": 300,
         "description": "The prompt cache expiration time in seconds for cached prompt data.",
         "exclusiveMinimum": 0,
         "title": "Prompt Cache Expiration",
         "type": "integer"
      },
      "subsystem_cache_prompt_response_expiration": {
         "default": 3600,
         "description": "Seconds to cache the LLM's answer to the first message of a conversation. 0 disables the cache.",
         "minimum": 0,
         "title": "Prompt Response Cache Expiration",
         "type": "integer"
      },
      "subsystem_cache_listview_expiration": {
         "default": 3600,
         "description": "The cache expiration time in seconds for the pages of the web console's list views.",
         "exclusiveMinimum": 0,
         "title": "List View Cache Expiration",
         "type": "integer"
      },
      "subsystem_cache_llm_client_expiration": {
         "default": 300,
         "description": "The llmclient cache expiration time in seconds for cached llmclient data.",
         "exclusiveMinimum": 0,
         "title": "LLMClient Cache Expiration",
         "type": "integer"
      },
      "platform_branding_app_name": {
         "default": "Smarter",
         "description": "The application's name, which prefixes the names of the platform's Django apps in the admin and the web console.",
         "examples": [
            "Acme AI"
         ],
         "title": "Branding App Name",
         "type": "string"
      },
      "platform_branding_product_name": {
         "default": "The Smarter Project",
         "description": "The product's name, shown in the web console, emails and documentation.",
         "examples": [
            "Acme AI Platform"
         ],
         "title": "Branding Product Name",
         "type": "string"
      },
      "platform_branding_product_description": {
         "default": "An open source, no-code AI authoring platform designed for instructional use.",
         "description": "A one-sentence description of the product, shown in the web console and in page metadata.",
         "examples": [
            "A no-code AI platform for Acme's teams."
         ],
         "title": "Branding Product Description",
         "type": "string"
      },
      "platform_branding_cdn_url": {
         "default": "https://cdn.smarter.sh/",
         "description": "The CDN of the product's own static assets, e.g. its logo and Open Graph image.",
         "examples": [
            "https://cdn.example.com"
         ],
         "format": "uri",
         "maxLength": 2083,
         "minLength": 1,
         "title": "Branding CDN URL",
         "type": "string"
      },
      "platform_branding_docs_url": {
         "default": "https://docs.smarter.sh/",
         "description": "The product's documentation site, linked from the web console and the api.",
         "examples": [
            "https://docs.example.com"
         ],
         "format": "uri",
         "maxLength": 2083,
         "minLength": 1,
         "title": "Branding Documentation URL",
         "type": "string"
      },
      "platform_branding_blog_url": {
         "default": "https://blog.smarter.sh/",
         "description": "The product's blog, e.g. its release announcements.",
         "examples": [
            "https://blog.example.com"
         ],
         "format": "uri",
         "maxLength": 2083,
         "minLength": 1,
         "title": "Branding Blog URL",
         "type": "string"
      },
      "platform_branding_corporate_name": {
         "default": "Lawrence P. McDaniel",
         "description": "The corporate name used for branding purposes throughout the platform.",
         "examples": [
            "Acme Corporation"
         ],
         "title": "Branding Corporate Name",
         "type": "string"
      },
      "platform_branding_support_phone_number": {
         "default": "(###) 555-1212",
         "description": "The support phone number used for branding purposes throughout the platform.",
         "examples": [
            "+1-800-555-1234"
         ],
         "title": "Branding Support Phone Number",
         "type": "string"
      },
      "platform_branding_support_email": {
         "default": "lpm0073@gmail.com",
         "description": "The support email address used for branding purposes throughout the platform.",
         "format": "email",
         "title": "Branding Support Email",
         "type": "string"
      },
      "platform_branding_address1": {
         "default": "123 Main St, Anytown, USA",
         "description": "The corporate address used for branding purposes throughout the platform.",
         "examples": [
            "123 Main St, Anytown, USA"
         ],
         "title": "Branding Address",
         "type": "string"
      },
      "platform_branding_address2": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "Suite 100",
         "description": "The second line of the corporate address used for branding purposes throughout the platform.",
         "examples": [
            "Suite 100"
         ],
         "title": "Branding Address Line 2"
      },
      "platform_branding_city": {
         "default": "Anytown",
         "description": "The corporate city used for branding purposes throughout the platform.",
         "examples": [
            "Anytown"
         ],
         "title": "Branding City",
         "type": "string"
      },
      "platform_branding_state": {
         "default": "CA",
         "description": "The corporate state used for branding purposes throughout the platform.",
         "examples": [
            "CA"
         ],
         "title": "Branding State",
         "type": "string"
      },
      "platform_branding_postal_code": {
         "default": "12345",
         "description": "The corporate postal code used for branding purposes throughout the platform.",
         "examples": [
            "12345"
         ],
         "title": "Branding Postal Code",
         "type": "string"
      },
      "platform_branding_country": {
         "default": "USA",
         "description": "The corporate country used for branding purposes throughout the platform.",
         "examples": [
            "USA"
         ],
         "title": "Branding Country",
         "type": "string"
      },
      "platform_branding_currency": {
         "default": "USD",
         "description": "The currency used for branding purposes throughout the platform.",
         "examples": [
            "USD"
         ],
         "title": "Branding Currency",
         "type": "string"
      },
      "platform_branding_timezone": {
         "default": "America/Denver",
         "description": "The timezone used for branding purposes throughout the platform.",
         "examples": [
            "America/New_York"
         ],
         "title": "Branding Timezone",
         "type": "string"
      },
      "platform_branding_contact_url": {
         "anyOf": [
            {
               "format": "uri",
               "maxLength": 2083,
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "https://lawrencemcdaniel.com/",
         "description": "The contact URL used for branding purposes throughout the platform.",
         "examples": [
            "https://www.example.com/contact"
         ],
         "title": "Branding Contact URL"
      },
      "platform_branding_primary_contact": {
         "default": "Lawrence McDaniel",
         "description": "The name of the person who is the technical point of contact for this platform.",
         "examples": [
            "Lawrence McDaniel"
         ],
         "title": "Branding Primary Contact",
         "type": "string"
      },
      "platform_branding_support_hours": {
         "default": "MON-FRI 9:00 AM - 5:00 PM GMT-6 (CST)",
         "description": "The support hours used for branding purposes throughout the platform.",
         "examples": [
            "Mon-Fri 9am-5pm EST"
         ],
         "title": "Branding Support Hours",
         "type": "string"
      },
      "platform_branding_url_facebook": {
         "anyOf": [
            {
               "format": "uri",
               "maxLength": 2083,
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "https://facebook.com/",
         "description": "The Facebook URL used for branding purposes throughout the platform.",
         "examples": [
            "https://www.facebook.com/example"
         ],
         "title": "Branding URL Facebook"
      },
      "platform_branding_url_twitter": {
         "anyOf": [
            {
               "format": "uri",
               "maxLength": 2083,
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "https://x.com/fullstackwlarry",
         "description": "The Twitter URL used for branding purposes throughout the platform.",
         "examples": [
            "https://www.twitter.com/example"
         ],
         "title": "Branding URL Twitter"
      },
      "platform_branding_url_linkedin": {
         "anyOf": [
            {
               "format": "uri",
               "maxLength": 2083,
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "https://www.linkedin.com/in/lawrencemcdaniel/",
         "description": "The LinkedIn URL used for branding purposes throughout the platform.",
         "examples": [
            "https://www.linkedin.com/company/example"
         ],
         "title": "Branding URL LinkedIn"
      },
      "platform_branding_url_slack": {
         "anyOf": [
            {
               "format": "uri",
               "maxLength": 2083,
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "https://join.slack.com/t/thesmarterproject/shared_invite/zt-4f0t6v46q-e2c5Of4hS4fBr_XwfQARCw",
         "description": "The invite link of the Slack workspace that the platform's emails invite users to.",
         "examples": [
            "https://join.slack.com/t/example/shared_invite/zt-example"
         ],
         "title": "Branding URL Slack"
      },
      "platform_branding_logo": {
         "anyOf": [
            {
               "format": "uri",
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The URL to the platform's logo image.",
         "examples": [
            "https://cdn.example.com/logo.png"
         ],
         "title": "Platform Logo URL"
      },
      "platform_branding_marketing_site_url": {
         "anyOf": [
            {
               "format": "uri",
               "maxLength": 2083,
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The URL to the platform's marketing site.",
         "examples": [
            "https://www.example.com"
         ],
         "title": "Marketing Site URL"
      },
      "subsystem_logging_loki_url": {
         "default": "",
         "description": "The base url of the Loki that stores the platform's pod logs, e.g. http://smarter-loki:3100. Empty: there is none.",
         "examples": [
            "http://smarter-loki:3100"
         ],
         "title": "Loki URL",
         "type": "string"
      },
      "overrides_file": {
         "default": "/home/smarter_user/overrides/settings.yaml",
         "description": "The path of the YAML file of overrides, which overwrite Smarter's Django settings.",
         "examples": [
            "/home/smarter_user/overrides/settings.yaml"
         ],
         "title": "Overrides File",
         "type": "string"
      },
      "bootstrap_secrets_dir": {
         "default": "/home/smarter_user/bootstrap-secrets",
         "description": "The folder of files from which the init Job creates Smarter Secrets, one per file.",
         "examples": [
            "/home/smarter_user/bootstrap-secrets"
         ],
         "title": "Bootstrap Secrets Folder",
         "type": "string"
      },
      "SERVICE_TYPE": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The kind of pod this process runs in, e.g. api or worker-tools. Empty: unknown.",
         "examples": [
            "api"
         ],
         "title": "Service Type"
      },
      "environment": {
         "default": "local",
         "description": "The deployment environment for the platform.",
         "examples": [
            "local",
            "alpha",
            "beta",
            "next",
            "prod"
         ],
         "title": "Deployment Environment",
         "type": "string"
      },
      "platform_subdomain": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "platform",
         "description": "The subdomain for the platform, used in constructing URLs and email addresses.",
         "examples": [
            "platform",
            "ubc"
         ],
         "title": "Platform Subdomain"
      },
      "platform_root_domain": {
         "default": "example.com",
         "description": "The root domain for the platform.",
         "examples": [
            "example.com"
         ],
         "title": "Root Domain",
         "type": "string"
      },
      "platform_settings_output": {
         "default": false,
         "description": "Flag to enable or disable output of settings for debugging purposes.",
         "examples": [
            true,
            false
         ],
         "title": "Settings Output",
         "type": "boolean"
      },
      "platform_shared_resource_identifier": {
         "default": "smarter",
         "description": "Smarter 1-word identifier to be used when naming any shared resource.",
         "examples": [
            "smarter",
            "mycompany",
            "myproject"
         ],
         "title": "Shared Resource Identifier",
         "type": "string"
      },
      "AWS_PROFILE": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The AWS profile to use for authentication. If present, this will take precedence over AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.",
         "examples": [
            "default",
            "smarter-profile"
         ],
         "title": "AWS Profile"
      },
      "AWS_ACCESS_KEY_ID": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The AWS access key ID for authentication. Used if AWS_PROFILE is not set. Masked by pydantic SecretStr.",
         "examples": [
            "^AKIA[0-9A-Z]{16}$"
         ],
         "title": "AWS Access Key ID"
      },
      "AWS_SECRET_ACCESS_KEY": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The AWS secret access key for authentication. Used if AWS_PROFILE is not set. Masked by pydantic SecretStr.",
         "examples": [
            "^[0-9a-zA-Z/+]{40}$"
         ],
         "title": "AWS Secret Access Key"
      },
      "aws_regions": {
         "default": [
            "us-east-1",
            "us-east-2",
            "us-west-1",
            "us-west-2",
            "af-south-1",
            "ap-east-1",
            "ap-northeast-1",
            "ap-northeast-2",
            "ap-northeast-3",
            "ap-south-1",
            "ap-south-2",
            "ap-southeast-1",
            "ap-southeast-2",
            "ap-southeast-3",
            "ap-southeast-4",
            "ap-southeast-5",
            "ap-southeast-7",
            "ca-central-1",
            "ca-west-1",
            "eu-central-1",
            "eu-central-2",
            "eu-north-1",
            "eu-south-1",
            "eu-south-2",
            "eu-west-1",
            "eu-west-2",
            "eu-west-3",
            "il-central-1",
            "me-central-1",
            "me-south-1",
            "mx-central-1",
            "sa-east-1"
         ],
         "description": "A list of AWS regions considered valid for this platform.",
         "examples": [
            "us-east-1",
            "us-west-2",
            "eu-west-1"
         ],
         "items": {
            "type": "string"
         },
         "title": "AWS Regions",
         "type": "array"
      },
      "AWS_REGION": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The single AWS region in which all AWS service clients will operate.",
         "examples": [
            "us-east-1",
            "us-west-2",
            "eu-west-1"
         ],
         "title": "AWS Region"
      },
      "platform_cloud_provider": {
         "default": "aws",
         "description": "The cloud provider of the platform's infrastructure services: DNS, TLS certificates, and the Kubernetes cluster's credentials.",
         "examples": [
            "aws",
            "memory"
         ],
         "title": "Cloud Provider",
         "type": "string"
      },
      "subsystem_k8s_cluster_name": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The name of the Kubernetes cluster that hosts the platform, e.g. its EKS cluster on AWS.",
         "examples": [
            "apps-hosting-service"
         ],
         "title": "Kubernetes Cluster Name"
      },
      "app_llmhost_node_role_arn": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The IAM role of the node groups that Smarter creates for LLMHosts.",
         "examples": [
            "arn:aws:iam::123456789012:role/eks-node-role"
         ],
         "title": "LLMHost Node Role ARN"
      },
      "app_llmhost_node_subnet_ids": {
         "default": [],
         "description": "The subnets of the node groups that Smarter creates for LLMHosts.",
         "examples": [
            [
               "subnet-0123456789abcdef0"
            ]
         ],
         "items": {
            "type": "string"
         },
         "title": "LLMHost Node Subnet IDs",
         "type": "array"
      },
      "platform_email_admin": {
         "default": "admin@example.com",
         "description": "The administrator email address used for system notifications and alerts.",
         "examples": [
            "admin@example.com"
         ],
         "format": "email",
         "title": "Administrator Email Address",
         "type": "string"
      },
      "subsystem_smtp_sender": {
         "anyOf": [
            {
               "format": "email",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The sender email address for SMTP emails.",
         "examples": [
            "sender@example.com"
         ],
         "title": "SMTP Sender Email Address"
      },
      "subsystem_smtp_from_email": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The From address of outgoing email. Set with SMARTER_SUBSYSTEM_SMTP_FROM_EMAIL.",
         "examples": [
            "no-reply@example.com"
         ],
         "title": "SMTP From Address"
      },
      "subsystem_smtp_host": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The SMTP server. Set with SMARTER_SUBSYSTEM_SMTP_HOST.",
         "examples": [
            "email-smtp.us-east-1.amazonaws.com"
         ],
         "title": "SMTP Host"
      },
      "subsystem_smtp_password": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The SMTP password for authentication. Assumed to be an AWS SES-generated IAM keypair secret.",
         "examples": [
            "your-smtp-password"
         ],
         "title": "SMTP Password"
      },
      "subsystem_smtp_port": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": 587,
         "description": "The SMTP port for sending emails.",
         "examples": [
            25,
            465,
            587
         ],
         "title": "SMTP Port Number"
      },
      "subsystem_smtp_use_ssl": {
         "anyOf": [
            {
               "type": "boolean"
            },
            {
               "type": "null"
            }
         ],
         "default": false,
         "description": "Whether to use SSL for SMTP connections.",
         "examples": [
            true,
            false
         ],
         "title": "SMTP Use SSL"
      },
      "subsystem_smtp_use_tls": {
         "anyOf": [
            {
               "type": "boolean"
            },
            {
               "type": "null"
            }
         ],
         "default": true,
         "description": "Whether to use TLS for SMTP connections.",
         "examples": [
            true,
            false
         ],
         "title": "SMTP Use TLS"
      },
      "subsystem_smtp_username": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The SMTP username for authentication. Assumed to be an AWS SES-generatred IAM keypair username.",
         "examples": [
            "your-smtp-username"
         ],
         "title": "SMTP Username"
      },
      "allowed_hosts": {
         "default": [
            "localhost",
            "testserver"
         ],
         "description": "The hosts that the platform serves: its own domains, and those set with SMARTER_ALLOWED_HOSTS.",
         "examples": [
            [
               "localhost",
               "testserver"
            ]
         ],
         "items": {
            "type": "string"
         },
         "title": "Allowed Hosts",
         "type": "array"
      },
      "api_schema": {
         "default": "http",
         "description": "The schema of the api's urls, http or https. Set with SMARTER_API_SCHEMA. Always http locally.",
         "examples": [
            "http",
            "https"
         ],
         "title": "API Schema",
         "type": "string"
      }
   },
   "additionalProperties": false
}

Config:
  • env_prefix: str = SMARTER_

  • enable_decoding: bool = False

  • populate_by_name: bool = True

  • frozen: bool = True

  • validate_by_alias: bool = True

  • validate_by_name: bool = True

Fields:

Validators:
  • secret_from_string » all fields

validator secret_from_string  »  all fields[source]

Unquote a string, and wrap a secret’s in a SecretStr, before any of its field’s validators see it.

An environment variable is always a string. Its surrounding quotes are stripped (unquoted()), since make exports .env’s lines with them. A secret is masked from the moment it is read, so that no validator, error message or log can show it.

Parameters:
  • v (object) – The value to validate.

  • info (ValidationInfo) – Pydantic’s validation info, which names the field.

Return type:

object

Returns:

A SecretStr for a secret’s string, the unquoted string otherwise, or the value itself if it is not a string.

Topics

pydantic model smarter.common.conf.settings.platform.PlatformSettings[source]

The platform’s identity: its environment, root domain, platform subdomain, and shared resources.

Show JSON schema
{
   "title": "PlatformSettings",
   "description": "The platform's identity: its environment, root domain, platform subdomain, and shared resources.",
   "type": "object",
   "properties": {
      "subsystem_logging_loki_url": {
         "default": "",
         "description": "The base url of the Loki that stores the platform's pod logs, e.g. http://smarter-loki:3100. Empty: there is none.",
         "examples": [
            "http://smarter-loki:3100"
         ],
         "title": "Loki URL",
         "type": "string"
      },
      "overrides_file": {
         "default": "/home/smarter_user/overrides/settings.yaml",
         "description": "The path of the YAML file of overrides, which overwrite Smarter's Django settings.",
         "examples": [
            "/home/smarter_user/overrides/settings.yaml"
         ],
         "title": "Overrides File",
         "type": "string"
      },
      "bootstrap_secrets_dir": {
         "default": "/home/smarter_user/bootstrap-secrets",
         "description": "The folder of files from which the init Job creates Smarter Secrets, one per file.",
         "examples": [
            "/home/smarter_user/bootstrap-secrets"
         ],
         "title": "Bootstrap Secrets Folder",
         "type": "string"
      },
      "SERVICE_TYPE": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The kind of pod this process runs in, e.g. api or worker-tools. Empty: unknown.",
         "examples": [
            "api"
         ],
         "title": "Service Type"
      },
      "environment": {
         "default": "local",
         "description": "The deployment environment for the platform.",
         "examples": [
            "local",
            "alpha",
            "beta",
            "next",
            "prod"
         ],
         "title": "Deployment Environment",
         "type": "string"
      },
      "platform_subdomain": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "platform",
         "description": "The subdomain for the platform, used in constructing URLs and email addresses.",
         "examples": [
            "platform",
            "ubc"
         ],
         "title": "Platform Subdomain"
      },
      "platform_root_domain": {
         "default": "example.com",
         "description": "The root domain for the platform.",
         "examples": [
            "example.com"
         ],
         "title": "Root Domain",
         "type": "string"
      },
      "platform_settings_output": {
         "default": false,
         "description": "Flag to enable or disable output of settings for debugging purposes.",
         "examples": [
            true,
            false
         ],
         "title": "Settings Output",
         "type": "boolean"
      },
      "platform_shared_resource_identifier": {
         "default": "smarter",
         "description": "Smarter 1-word identifier to be used when naming any shared resource.",
         "examples": [
            "smarter",
            "mycompany",
            "myproject"
         ],
         "title": "Shared Resource Identifier",
         "type": "string"
      }
   }
}

Fields:
Validators:
field bootstrap_secrets_dir: str = '/home/smarter_user/bootstrap-secrets'

The folder from which manage.py initialize_bootstrap_secrets creates Smarter Secrets, one per file.

Each file is named after its Secret, e.g. openai_api_key, and holds its value (issue #1099).

This is how a built-in Provider’s, a search service’s or a managed vector database’s key reaches the platform, rather than as an environment variable: the key’s only source is then its Smarter Secret, which every service reads. The Helm chart mounts the Kubernetes Secret smarter-bootstrap-secrets here, in the init Job only. Locally, docker-compose mounts the repository’s bootstrap-secrets/ here, in smarter-api only, which make bootstrap-secrets fills from .env. A missing folder is not an error: there is nothing to create.

Type:

str

Default:

"/home/smarter_user/bootstrap-secrets"

The folder of files from which the init Job creates Smarter Secrets, one per file.

field environment: str = 'local'

The deployment environment for the platform.

This setting indicates the environment in which the platform is running, such as development, staging, or production. It can be used to adjust behavior and configurations based on the environment.

Type:

str

Default:

SmarterEnvironments.LOCAL

Raises:

SmarterConfigurationError – If the value is not a valid environment name from SmarterEnvironments.all

The deployment environment for the platform.

Validated by:
field overrides_file: str = '/home/smarter_user/overrides/settings.yaml'

The path of the overrides file: a YAML mapping of Django setting names to values, which.

overwrite every value in smarter.settings.

smarter.settings.overrides reads the file, from this same environment variable, before smarter_settings is used for anything else. A missing file is not an error: there are no overrides from a file. Locally, Docker Compose mounts overrides/ from the repository’s root here. The Helm chart mounts no file: on Kubernetes, the deployment’s overrides are DJANGO_* variables in the chart’s env.

Type:

str

Default:

"/home/smarter_user/overrides/settings.yaml"

The path of the YAML file of overrides, which overwrite Smarter’s Django settings.

field platform_root_domain: str = 'example.com'

The root domain for the platform.

This setting specifies the primary domain name used by the platform. It is used for constructing URLs, email addresses, and other domain-related configurations.

Type:

str

Default:

"example.com"

Raises:

SmarterConfigurationError – If the value is not a valid domain name.

The root domain for the platform.

Validated by:
field platform_settings_output: bool = False

If True, enables verbose output of Smarter run-time settings during Django startup.

This will generate a multi-line header in new terminal windows launched from Kubernetes pods running Smarter services.

Type:

bool

Default:

False

Raises:

SmarterConfigurationError – If the value is not a boolean.

Flag to enable or disable output of settings for debugging purposes.

Validated by:
field platform_shared_resource_identifier: str = 'smarter'

A single, lowercase word used as a unique identifier for all shared resources across the Smarter platform.

This value is used as a prefix or namespace when naming resources that are shared between services, environments, or deployments—such as S3 buckets, Kubernetes namespaces, or other cloud resources. It ensures that resource names are consistent, easily identifiable, and do not conflict with those from other projects or organizations.

Important

  • The identifier should be a simple word, using only lowercase letters.

  • Avoid changing this value after initial deployment, as it would likely lead to resource naming conflicts and unintended consequences in Kubernetes, cloud infrastructure, and other services relying on consistent naming conventions.

Typical usage:
  • As a prefix for cloud resource names (e.g., smarter-platform-alpha)

  • To distinguish resources in multi-tenant or multi-environment deployments

  • For automated naming conventions in infrastructure-as-code and deployment scripts

Examples:
  • smarter

  • mycompany

  • myproject

Type:

str

Default:

"smarter"

Raises:

SmarterConfigurationError – If the value is not a string.

Smarter 1-word identifier to be used when naming any shared resource.

Validated by:
field platform_subdomain: str | None = 'platform'

The subdomain for the platform, used in constructing URLs and email addresses.

field service_type: str | None = None

The kind of pod this process runs in: one of smarter.common.const.SmarterKubernetesPodKinds.all, e.g. api or worker-extensions.

The Helm chart sets SERVICE_TYPE on every pod, and docker-compose on every service. It isn’t a secret. smarter_settings names the kind when it reports that it is READY, with the checks that it made for that kind, and refuses to start a pod whose kind contradicts what it can see for itself, e.g. a worker-extensions pod with a database (check_service_type()). Unset, e.g. in a local script or a manage.py shell, the kind is unknown, and is reported so.

Type:

Optional[str]

Default:

None, an unknown kind.

Raises:

SmarterConfigurationError – If the value is not one of smarter.common.const.SmarterKubernetesPodKinds.all.

The kind of pod this process runs in, e.g. api or worker-tools. Empty: unknown.

Validated by:
field subsystem_logging_loki_url: str = ''

The base url of the Loki that stores the last 72 hours of the platform’s pod logs.

The Helm chart runs Loki in the platform’s namespace, and sets this to its Service, e.g. http://smarter-loki:3100. The MCPServer’s staff-only log tools query it, through smarter.apps.infrastructure.services.infrastructure .logs. While it is empty, e.g. in local development, the log tools say that there is no log store. :type: str :default: "" :raises SmarterConfigurationError: If the value is not an http or https url.

The base url of the Loki that stores the platform’s pod logs, e.g. http://smarter-loki:3100. Empty: there is none.

Validated by:
validator validate_environment  »  environment[source]

Validates the environment field.

Parameters:

v (str | None) – The environment value to validate.

Returns:

The validated environment.

Return type:

str

validator validate_platform_root_domain  »  platform_root_domain[source]

Validates the root_domain field.

If the value is not set, returns the default root domain.

Parameters:

v (str | None) – The root domain value to validate.

Returns:

The validated root domain.

Return type:

str

validator validate_platform_settings_output  »  platform_settings_output[source]

Validates the settings_output field.

Parameters:

v (bool | str | None) – The settings output value to validate.

Returns:

The validated settings output.

Return type:

bool

validator validate_platform_shared_resource_identifier  »  platform_shared_resource_identifier[source]

Validates the shared_resource_identifier field.

Uses the field’s default if no value is received.

Parameters:

v (str | None) – The shared resource identifier to validate.

Returns:

The validated shared resource identifier.

Return type:

str

validator validate_service_type  »  service_type[source]

Validate service_type: one of smarter.common.const.SmarterKubernetesPodKinds.all, trimmed and in lower case, or None.

Parameters:

v (str | None) – The kind, or empty.

Return type:

str | None

Returns:

The kind, or None.

Raises:

SmarterConfigurationError – If the value is not one of smarter.common.const.SmarterKubernetesPodKinds.all.

validator validate_subsystem_logging_loki_url  »  subsystem_logging_loki_url[source]

Validates the ‘loki_url’ field: an http or https url without a trailing slash, or empty.

Parameters:

v (str | None) – the url.

Returns:

The validated url.

Return type:

str

class smarter.common.const.SmarterKubernetesPodKinds[source]

The fixed set of kinds of pod that the platform runs: the values of SERVICE_TYPE.

The Helm chart sets SERVICE_TYPE on each Deployment and Job, and docker-compose on each service, and smarter_settings.service_type validates it against all. The settings check each kind for what it should and shouldn’t hold (ADR-038). This class says what each kind is; what each kind does with a credential is SmarterPodCapabilities.

all = ['api', 'worker', 'worker-infrastructure', 'beat', 'worker-tools', 'worker-extensions', 'job-init', 'job-migrate', 'job-backup', 'bastion']

Every kind of pod.

labels: Dict[str, str] = {'api': 'the api server', 'bastion': 'the bastion', 'beat': 'Celery Beat', 'job-backup': 'the backup job', 'job-init': 'the init job', 'job-migrate': 'the migrate job', 'worker': 'the worker', 'worker-extensions': 'the Extension worker', 'worker-infrastructure': 'the infrastructure worker', 'worker-tools': 'the tool worker'}

for the tool worker.

Type:

How each kind’s name reads in a sentence, e.g. in the settings’ READY line

restricted = ['worker-tools', 'worker-extensions']

The kinds without a database, which run code that the platform doesn’t control (ADR-038, issue #1077).

with_database = ['api', 'worker', 'worker-infrastructure', 'beat', 'job-init', 'job-migrate', 'job-backup', 'bastion']

every one but the restricted workers, which a test checks.

Type:

The kinds with a database

class smarter.common.const.SmarterPodCapabilities[source]

What a kind of pod does that needs a credential: each capability lists the kinds of pod that have it (ADR-038).

A credential setting names the capability that uses it, e.g. HeldBy(*SmarterPodCapabilities.email) on SMTP’s password, so that only those kinds hold it (smarter.common.conf.credentials). They are lists of members, not the Kubernetes Roles or the IAM roles that the Helm chart and smarter-infrastructure create: those are one per kind of pod, for all of its capabilities at once. What a pod is, e.g. whether it has a database, is on SmarterKubernetesPodKinds.

aws = ['api', 'worker', 'worker-infrastructure', 'job-init', 'job-backup', 'bastion']

S3, Route53, ACM and EKS.

On Kubernetes, each kind with its own IAM role, and no key.

The backup Job saves its dump to S3. Celery Beat and the migrate Job make no AWS call, and have no role (ADR-038, phase 3), so the settings don’t ask STS for credentials there (Settings.uses_aws).

Type:

Call AWS

database_admin = ['job-init', 'job-backup', 'bastion']

Administer the database server, as its administrator or the backup account.

The init Job creates the database, its user and the backup account. The backup Job dumps the database as the backup account, or as the administrator until that account exists. The bastion is for a person who does either.

email = ['api', 'worker', 'worker-infrastructure', 'job-init', 'job-backup']

the app, both workers, the init Job, and the backup Job.

smarter-worker-infrastructure emails a custom domain’s verification result, and the backup Job its own result.

Type:

Send email, with SMTP’s credentials

job_logs = ['job-init', 'job-backup']

the init Job and the backup Job.

Type:

Post a Job’s log to Slack, with manage.py email_job_log

signing = ['api', 'worker', 'worker-infrastructure', 'job-init']

the app, both workers and the init Job.

E.g. an account contact’s email, which the workers send, carries an unsubscribe token signed with SECRET_KEY. Celery Beat and the migrate Job sign nothing, and start with a random key of their own.

Type:

Sign what the app verifies, with the Django secret key

smarter_secrets = ['api', 'worker', 'worker-infrastructure', 'job-init']

the app, both workers and the init Job.

The tasks that use a Secret’s value, e.g. an LLMHost’s api key or a plugin’s connection, run in the workers, and the init Job creates the bootstrap Secrets.

Type:

Decrypt and encrypt Smarter Secrets, with the Fernet key

pydantic model smarter.common.conf.settings.domains.DomainSettings[source]

The domains, urls, hosts and bucket names that are derived from the platform’s identity.

Show JSON schema
{
   "title": "DomainSettings",
   "description": "The domains, urls, hosts and bucket names that are derived from the platform's identity.",
   "type": "object",
   "properties": {
      "subsystem_logging_loki_url": {
         "default": "",
         "description": "The base url of the Loki that stores the platform's pod logs, e.g. http://smarter-loki:3100. Empty: there is none.",
         "examples": [
            "http://smarter-loki:3100"
         ],
         "title": "Loki URL",
         "type": "string"
      },
      "overrides_file": {
         "default": "/home/smarter_user/overrides/settings.yaml",
         "description": "The path of the YAML file of overrides, which overwrite Smarter's Django settings.",
         "examples": [
            "/home/smarter_user/overrides/settings.yaml"
         ],
         "title": "Overrides File",
         "type": "string"
      },
      "bootstrap_secrets_dir": {
         "default": "/home/smarter_user/bootstrap-secrets",
         "description": "The folder of files from which the init Job creates Smarter Secrets, one per file.",
         "examples": [
            "/home/smarter_user/bootstrap-secrets"
         ],
         "title": "Bootstrap Secrets Folder",
         "type": "string"
      },
      "SERVICE_TYPE": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The kind of pod this process runs in, e.g. api or worker-tools. Empty: unknown.",
         "examples": [
            "api"
         ],
         "title": "Service Type"
      },
      "environment": {
         "default": "local",
         "description": "The deployment environment for the platform.",
         "examples": [
            "local",
            "alpha",
            "beta",
            "next",
            "prod"
         ],
         "title": "Deployment Environment",
         "type": "string"
      },
      "platform_subdomain": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "platform",
         "description": "The subdomain for the platform, used in constructing URLs and email addresses.",
         "examples": [
            "platform",
            "ubc"
         ],
         "title": "Platform Subdomain"
      },
      "platform_root_domain": {
         "default": "example.com",
         "description": "The root domain for the platform.",
         "examples": [
            "example.com"
         ],
         "title": "Root Domain",
         "type": "string"
      },
      "platform_settings_output": {
         "default": false,
         "description": "Flag to enable or disable output of settings for debugging purposes.",
         "examples": [
            true,
            false
         ],
         "title": "Settings Output",
         "type": "boolean"
      },
      "platform_shared_resource_identifier": {
         "default": "smarter",
         "description": "Smarter 1-word identifier to be used when naming any shared resource.",
         "examples": [
            "smarter",
            "mycompany",
            "myproject"
         ],
         "title": "Shared Resource Identifier",
         "type": "string"
      },
      "allowed_hosts": {
         "default": [
            "localhost",
            "testserver"
         ],
         "description": "The hosts that the platform serves: its own domains, and those set with SMARTER_ALLOWED_HOSTS.",
         "examples": [
            [
               "localhost",
               "testserver"
            ]
         ],
         "items": {
            "type": "string"
         },
         "title": "Allowed Hosts",
         "type": "array"
      },
      "api_schema": {
         "default": "http",
         "description": "The schema of the api's urls, http or https. Set with SMARTER_API_SCHEMA. Always http locally.",
         "examples": [
            "http",
            "https"
         ],
         "title": "API Schema",
         "type": "string"
      }
   }
}

Fields:
Validators:
field allowed_hosts: List[str] = ['localhost', 'testserver']

The host names that the platform serves, Django’s ALLOWED_HOSTS: its own domains, and the.

hosts set with SMARTER_ALLOWED_HOSTS, a comma-separated list.

The platform’s domains are always added: see add_platform_hosts(). localhost and testserver are there for Kubernetes’ liveness and readiness probes, and for Django’s test client. Smarter’s own middleware validates hosts as well: see smarter.apps.llmclient.middleware.security.SmarterSecurityMiddleware.

Type:

List[str]

Default:

["localhost", "testserver"], plus the platform’s domains

The hosts that the platform serves: its own domains, and those set with SMARTER_ALLOWED_HOSTS.

Validated by:
field api_schema: str = 'http'

The schema of the api’s urls, http or https.

Set it with SMARTER_API_SCHEMA. The local environment always uses http, whatever it is set to: see local_api_schema().

Type:

str

Default:

"http"

Raises:

SmarterConfigurationError – If the value is neither http nor https.

The schema of the api’s urls, http or https. Set with SMARTER_API_SCHEMA. Always http locally.

Validated by:
validator local_api_schema  »  all fields[source]

Use http for the api’s urls in the local environment, which serves no https.

Parameters:

data (object) – The values to validate: the constructor’s and the environment’s.

Return type:

object

Returns:

The values, with api_schema set to http in the local environment.

validator validate_allowed_hosts  »  allowed_hosts[source]

Validates the allowed_hosts field: a list, or a comma-separated string.

Parameters:

v (List[str] | str | None) – The hosts.

Returns:

The hosts, or the default if it is empty.

Return type:

List[str]

validator validate_api_schema  »  api_schema[source]

Validates the api_schema field: http or https, or the default if it is empty.

Parameters:

v (str | None) – The schema.

Returns:

The validated schema.

Return type:

str

validator add_platform_hosts  »  all fields[source]

Add the platform’s own domains to allowed_hosts, so that it is the complete list.

The domains, e.g. environment_platform_domain, are derived from the validated environment, root domain and subdomain, so they are added once those are validated. Each host with a port is added without it as well. Every host is validated.

Return type:

DomainSettings

Returns:

The settings, whose allowed_hosts is final.

Raises:

SmarterConfigurationError – If a host is not a valid hostname.

pydantic model smarter.common.conf.settings.aws.AwsSettings[source]

The cloud provider: AWS credentials, region, and the EKS cluster.

Show JSON schema
{
   "title": "AwsSettings",
   "description": "The cloud provider: AWS credentials, region, and the EKS cluster.",
   "type": "object",
   "properties": {
      "AWS_PROFILE": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The AWS profile to use for authentication. If present, this will take precedence over AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.",
         "examples": [
            "default",
            "smarter-profile"
         ],
         "title": "AWS Profile"
      },
      "AWS_ACCESS_KEY_ID": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The AWS access key ID for authentication. Used if AWS_PROFILE is not set. Masked by pydantic SecretStr.",
         "examples": [
            "^AKIA[0-9A-Z]{16}$"
         ],
         "title": "AWS Access Key ID"
      },
      "AWS_SECRET_ACCESS_KEY": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The AWS secret access key for authentication. Used if AWS_PROFILE is not set. Masked by pydantic SecretStr.",
         "examples": [
            "^[0-9a-zA-Z/+]{40}$"
         ],
         "title": "AWS Secret Access Key"
      },
      "aws_regions": {
         "default": [
            "us-east-1",
            "us-east-2",
            "us-west-1",
            "us-west-2",
            "af-south-1",
            "ap-east-1",
            "ap-northeast-1",
            "ap-northeast-2",
            "ap-northeast-3",
            "ap-south-1",
            "ap-south-2",
            "ap-southeast-1",
            "ap-southeast-2",
            "ap-southeast-3",
            "ap-southeast-4",
            "ap-southeast-5",
            "ap-southeast-7",
            "ca-central-1",
            "ca-west-1",
            "eu-central-1",
            "eu-central-2",
            "eu-north-1",
            "eu-south-1",
            "eu-south-2",
            "eu-west-1",
            "eu-west-2",
            "eu-west-3",
            "il-central-1",
            "me-central-1",
            "me-south-1",
            "mx-central-1",
            "sa-east-1"
         ],
         "description": "A list of AWS regions considered valid for this platform.",
         "examples": [
            "us-east-1",
            "us-west-2",
            "eu-west-1"
         ],
         "items": {
            "type": "string"
         },
         "title": "AWS Regions",
         "type": "array"
      },
      "AWS_REGION": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The single AWS region in which all AWS service clients will operate.",
         "examples": [
            "us-east-1",
            "us-west-2",
            "eu-west-1"
         ],
         "title": "AWS Region"
      },
      "platform_cloud_provider": {
         "default": "aws",
         "description": "The cloud provider of the platform's infrastructure services: DNS, TLS certificates, and the Kubernetes cluster's credentials.",
         "examples": [
            "aws",
            "memory"
         ],
         "title": "Cloud Provider",
         "type": "string"
      },
      "subsystem_k8s_cluster_name": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The name of the Kubernetes cluster that hosts the platform, e.g. its EKS cluster on AWS.",
         "examples": [
            "apps-hosting-service"
         ],
         "title": "Kubernetes Cluster Name"
      },
      "app_llmhost_node_role_arn": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The IAM role of the node groups that Smarter creates for LLMHosts.",
         "examples": [
            "arn:aws:iam::123456789012:role/eks-node-role"
         ],
         "title": "LLMHost Node Role ARN"
      },
      "app_llmhost_node_subnet_ids": {
         "default": [],
         "description": "The subnets of the node groups that Smarter creates for LLMHosts.",
         "examples": [
            [
               "subnet-0123456789abcdef0"
            ]
         ],
         "items": {
            "type": "string"
         },
         "title": "LLMHost Node Subnet IDs",
         "type": "array"
      }
   }
}

Fields:
Validators:
field app_llmhost_node_role_arn: str | None = None

The IAM role of the EKS managed node groups that Smarter creates for LLMHostCompute.

If it is not set, Smarter uses the node role of the cluster’s first managed node group that it did not create, i.e. the node group that Smarter itself runs on.

Type:

Optional[str]

Default:

None

The IAM role of the node groups that Smarter creates for LLMHosts.

field app_llmhost_node_subnet_ids: List[str] = []

The subnets of the EKS managed node groups that Smarter creates for LLMHostCompute, e.g.

subnet-0123,subnet-0456. An LLMHostCompute’s own subnet_ids take precedence.

If it is not set, Smarter uses the subnets of the cluster’s first managed node group that it did not create. A model volume is an EBS volume in one availability zone, so an LLMHost whose retained volume is in one zone cannot be relaunched on a node in another: one subnet per node group avoids this.

Type:

List[str]

Default:

[]

The subnets of the node groups that Smarter creates for LLMHosts.

Validated by:
field aws_access_key_id: HeldBy(pods=frozenset({'worker-infrastructure', 'api', 'worker', 'job-backup', 'bastion', 'job-init'}))] = None

The AWS access key ID for authentication.

Used if AWS_PROFILE is not set. Masked by pydantic SecretStr. This setting provides the access key ID used to authenticate with AWS services. It is used in conjunction with the AWS secret access key to sign requests to AWS APIs.

Type:

SecretStr

Default:

None

Raises:

SmarterConfigurationError – If the value is not a valid AWS access key ID

The AWS access key ID for authentication. Used if AWS_PROFILE is not set. Masked by pydantic SecretStr.

Constraints:
  • pods = frozenset({‘worker-infrastructure’, ‘api’, ‘worker’, ‘job-backup’, ‘bastion’, ‘job-init’})

Validated by:
field aws_profile: str | None = None

The AWS profile to use for authentication.

If present, this will take precedence over AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. This setting specifies which AWS credentials profile to use when connecting to AWS services. Profiles are defined in the AWS credentials file (typically located at ~/.aws/credentials) and allow for managing multiple sets of credentials for different environments or accounts.

Type:

Optional[str]

Default:

None

Raises:

SmarterConfigurationError – If the value is not a string.

The AWS profile to use for authentication. If present, this will take precedence over AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

Validated by:
field aws_region: str | None = None

The single AWS region in which all AWS service clients will operate.

This setting specifies the default AWS region for the platform. All AWS service clients will be configured to use this region unless overridden on a per-client basis.

Type:

str

Default:

None

Raises:

SmarterConfigurationError – If the value is not a valid AWS region name.

The single AWS region in which all AWS service clients will operate.

Validated by:
field aws_regions: List[str] = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'af-south-1', 'ap-east-1', 'ap-northeast-1', 'ap-northeast-2', 'ap-northeast-3', 'ap-south-1', 'ap-south-2', 'ap-southeast-1', 'ap-southeast-2', 'ap-southeast-3', 'ap-southeast-4', 'ap-southeast-5', 'ap-southeast-7', 'ca-central-1', 'ca-west-1', 'eu-central-1', 'eu-central-2', 'eu-north-1', 'eu-south-1', 'eu-south-2', 'eu-west-1', 'eu-west-2', 'eu-west-3', 'il-central-1', 'me-central-1', 'me-south-1', 'mx-central-1', 'sa-east-1']

A list of AWS regions considered valid for this platform.

This setting defines the AWS regions that the platform is configured to operate in. It can be used to restrict operations to specific regions, ensuring that resources are created and managed only in approved locations.

Type:

List[str]

Default:

Value from AWS_REGIONS

Raises:

SmarterConfigurationError – If the value is not a list of valid AWS region names.

A list of AWS regions considered valid for this platform.

Validated by:
field aws_secret_access_key: HeldBy(pods=frozenset({'worker-infrastructure', 'api', 'worker', 'job-backup', 'bastion', 'job-init'}))] = None

The AWS secret access key for authentication.

Used if AWS_PROFILE is not set. Masked by pydantic SecretStr. This setting provides the secret access key used to authenticate with AWS services. It is used in conjunction with the AWS access key ID to sign requests to AWS APIs.

Type:

SecretStr

Default:

None

Raises:

SmarterConfigurationError – If the value is not a valid AWS secret access key

The AWS secret access key for authentication. Used if AWS_PROFILE is not set. Masked by pydantic SecretStr.

Constraints:
  • pods = frozenset({‘worker-infrastructure’, ‘api’, ‘worker’, ‘job-backup’, ‘bastion’, ‘job-init’})

Validated by:
field platform_cloud_provider: str = 'aws'

The cloud provider of the platform’s infrastructure services.

The platform reaches DNS, TLS certificates, and its Kubernetes cluster’s credentials only through smarter.apps.infrastructure.services, which uses this provider. aws is the only cloud that is implemented. memory keeps everything in memory, for local development without a cloud account.

Type:

str

Default:

aws

Raises:

SmarterConfigurationError – If the value is not a string.

The cloud provider of the platform’s infrastructure services: DNS, TLS certificates, and the Kubernetes cluster’s credentials.

Validated by:
field subsystem_k8s_cluster_name: str | None = None

The name of the Kubernetes cluster that hosts the platform: SMARTER_SUBSYSTEM_K8S_CLUSTER_NAME.

The platform deploys LLMClients and LLMHosts to it. On AWS it is an EKS cluster in the configured account, which the AWS infrastructure provider describes to build its kubeconfig.

It is optional. Without it, the platform runs, but LLMClients and LLMHosts are not deployed to Kubernetes, and the first attempt to reach the cluster logs how to set it.

Type:

Optional[str]

Default:

None if it is not set.

Raises:

SmarterConfigurationError – If the value is not a string.

The name of the Kubernetes cluster that hosts the platform, e.g. its EKS cluster on AWS.

Validated by:
validator validate_app_llmhost_node_subnet_ids  »  app_llmhost_node_subnet_ids[source]

Validates the llmhost_node_subnet_ids field: a list, or a comma-separated string.

Return type:

List[str]

validator validate_aws_access_key_id  »  aws_access_key_id[source]

Validates the aws_access_key_id field.

Uses the field’s default if no value is received.

Parameters:
  • v (SecretStr | None) – The AWS access key ID value to validate.

  • values (ValidationInfo) – The validation info containing other field values.

Returns:

The validated AWS access key ID.

Return type:

SecretStr | None

validator validate_aws_profile  »  aws_profile[source]

Validates the aws_profile field.

Uses the field’s default if no value is received.

Parameters:

v (str | None) – The AWS profile value to validate.

Returns:

The validated AWS profile.

Return type:

str | None

validator validate_aws_region  »  aws_region[source]

Validates the aws_region field.

Uses the field’s default if no value is received.

Parameters:
  • v (str | None) – The AWS region value to validate.

  • values (ValidationInfo) – The validation info containing other field values.

Returns:

The validated AWS region.

Return type:

str | None

validator validate_aws_regions  »  aws_regions[source]

Validates the aws_regions field: a list, or a comma-separated string.

Parameters:

v (List[str] | str | None) – The regions.

Returns:

The regions, or the default if it is empty.

Return type:

List[str]

validator validate_aws_secret_access_key  »  aws_secret_access_key[source]

Validates the aws_secret_access_key field.

Uses the field’s default if no value is received.

Parameters:
  • v (SecretStr | None) – The AWS secret access key value to validate.

  • values (ValidationInfo) – The validation info containing other field values.

Returns:

The validated AWS secret access key.

Return type:

SecretStr | None

validator validate_platform_cloud_provider  »  platform_cloud_provider[source]

Validates the cloud_provider field.

Parameters:

v (str | None) – The cloud provider’s name.

Returns:

The validated cloud provider’s name, in lower case.

Return type:

str

validator validate_subsystem_k8s_cluster_name  »  subsystem_k8s_cluster_name[source]

Validates the k8s_cluster_name field.

Parameters:

v (str | None) – The Kubernetes cluster name value to validate.

Returns:

The validated cluster name, or None if it is missing or a placeholder.

Return type:

str | None

pydantic model smarter.common.conf.settings.branding.BrandingSettings[source]

The platform operator’s branding: name, address, contacts, links and logo.

Show JSON schema
{
   "title": "BrandingSettings",
   "description": "The platform operator's branding: name, address, contacts, links and logo.",
   "type": "object",
   "properties": {
      "platform_branding_app_name": {
         "default": "Smarter",
         "description": "The application's name, which prefixes the names of the platform's Django apps in the admin and the web console.",
         "examples": [
            "Acme AI"
         ],
         "title": "Branding App Name",
         "type": "string"
      },
      "platform_branding_product_name": {
         "default": "The Smarter Project",
         "description": "The product's name, shown in the web console, emails and documentation.",
         "examples": [
            "Acme AI Platform"
         ],
         "title": "Branding Product Name",
         "type": "string"
      },
      "platform_branding_product_description": {
         "default": "An open source, no-code AI authoring platform designed for instructional use.",
         "description": "A one-sentence description of the product, shown in the web console and in page metadata.",
         "examples": [
            "A no-code AI platform for Acme's teams."
         ],
         "title": "Branding Product Description",
         "type": "string"
      },
      "platform_branding_cdn_url": {
         "default": "https://cdn.smarter.sh/",
         "description": "The CDN of the product's own static assets, e.g. its logo and Open Graph image.",
         "examples": [
            "https://cdn.example.com"
         ],
         "format": "uri",
         "maxLength": 2083,
         "minLength": 1,
         "title": "Branding CDN URL",
         "type": "string"
      },
      "platform_branding_docs_url": {
         "default": "https://docs.smarter.sh/",
         "description": "The product's documentation site, linked from the web console and the api.",
         "examples": [
            "https://docs.example.com"
         ],
         "format": "uri",
         "maxLength": 2083,
         "minLength": 1,
         "title": "Branding Documentation URL",
         "type": "string"
      },
      "platform_branding_blog_url": {
         "default": "https://blog.smarter.sh/",
         "description": "The product's blog, e.g. its release announcements.",
         "examples": [
            "https://blog.example.com"
         ],
         "format": "uri",
         "maxLength": 2083,
         "minLength": 1,
         "title": "Branding Blog URL",
         "type": "string"
      },
      "platform_branding_corporate_name": {
         "default": "Lawrence P. McDaniel",
         "description": "The corporate name used for branding purposes throughout the platform.",
         "examples": [
            "Acme Corporation"
         ],
         "title": "Branding Corporate Name",
         "type": "string"
      },
      "platform_branding_support_phone_number": {
         "default": "(###) 555-1212",
         "description": "The support phone number used for branding purposes throughout the platform.",
         "examples": [
            "+1-800-555-1234"
         ],
         "title": "Branding Support Phone Number",
         "type": "string"
      },
      "platform_branding_support_email": {
         "default": "lpm0073@gmail.com",
         "description": "The support email address used for branding purposes throughout the platform.",
         "format": "email",
         "title": "Branding Support Email",
         "type": "string"
      },
      "platform_branding_address1": {
         "default": "123 Main St, Anytown, USA",
         "description": "The corporate address used for branding purposes throughout the platform.",
         "examples": [
            "123 Main St, Anytown, USA"
         ],
         "title": "Branding Address",
         "type": "string"
      },
      "platform_branding_address2": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "Suite 100",
         "description": "The second line of the corporate address used for branding purposes throughout the platform.",
         "examples": [
            "Suite 100"
         ],
         "title": "Branding Address Line 2"
      },
      "platform_branding_city": {
         "default": "Anytown",
         "description": "The corporate city used for branding purposes throughout the platform.",
         "examples": [
            "Anytown"
         ],
         "title": "Branding City",
         "type": "string"
      },
      "platform_branding_state": {
         "default": "CA",
         "description": "The corporate state used for branding purposes throughout the platform.",
         "examples": [
            "CA"
         ],
         "title": "Branding State",
         "type": "string"
      },
      "platform_branding_postal_code": {
         "default": "12345",
         "description": "The corporate postal code used for branding purposes throughout the platform.",
         "examples": [
            "12345"
         ],
         "title": "Branding Postal Code",
         "type": "string"
      },
      "platform_branding_country": {
         "default": "USA",
         "description": "The corporate country used for branding purposes throughout the platform.",
         "examples": [
            "USA"
         ],
         "title": "Branding Country",
         "type": "string"
      },
      "platform_branding_currency": {
         "default": "USD",
         "description": "The currency used for branding purposes throughout the platform.",
         "examples": [
            "USD"
         ],
         "title": "Branding Currency",
         "type": "string"
      },
      "platform_branding_timezone": {
         "default": "America/Denver",
         "description": "The timezone used for branding purposes throughout the platform.",
         "examples": [
            "America/New_York"
         ],
         "title": "Branding Timezone",
         "type": "string"
      },
      "platform_branding_contact_url": {
         "anyOf": [
            {
               "format": "uri",
               "maxLength": 2083,
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "https://lawrencemcdaniel.com/",
         "description": "The contact URL used for branding purposes throughout the platform.",
         "examples": [
            "https://www.example.com/contact"
         ],
         "title": "Branding Contact URL"
      },
      "platform_branding_primary_contact": {
         "default": "Lawrence McDaniel",
         "description": "The name of the person who is the technical point of contact for this platform.",
         "examples": [
            "Lawrence McDaniel"
         ],
         "title": "Branding Primary Contact",
         "type": "string"
      },
      "platform_branding_support_hours": {
         "default": "MON-FRI 9:00 AM - 5:00 PM GMT-6 (CST)",
         "description": "The support hours used for branding purposes throughout the platform.",
         "examples": [
            "Mon-Fri 9am-5pm EST"
         ],
         "title": "Branding Support Hours",
         "type": "string"
      },
      "platform_branding_url_facebook": {
         "anyOf": [
            {
               "format": "uri",
               "maxLength": 2083,
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "https://facebook.com/",
         "description": "The Facebook URL used for branding purposes throughout the platform.",
         "examples": [
            "https://www.facebook.com/example"
         ],
         "title": "Branding URL Facebook"
      },
      "platform_branding_url_twitter": {
         "anyOf": [
            {
               "format": "uri",
               "maxLength": 2083,
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "https://x.com/fullstackwlarry",
         "description": "The Twitter URL used for branding purposes throughout the platform.",
         "examples": [
            "https://www.twitter.com/example"
         ],
         "title": "Branding URL Twitter"
      },
      "platform_branding_url_linkedin": {
         "anyOf": [
            {
               "format": "uri",
               "maxLength": 2083,
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "https://www.linkedin.com/in/lawrencemcdaniel/",
         "description": "The LinkedIn URL used for branding purposes throughout the platform.",
         "examples": [
            "https://www.linkedin.com/company/example"
         ],
         "title": "Branding URL LinkedIn"
      },
      "platform_branding_url_slack": {
         "anyOf": [
            {
               "format": "uri",
               "maxLength": 2083,
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "https://join.slack.com/t/thesmarterproject/shared_invite/zt-4f0t6v46q-e2c5Of4hS4fBr_XwfQARCw",
         "description": "The invite link of the Slack workspace that the platform's emails invite users to.",
         "examples": [
            "https://join.slack.com/t/example/shared_invite/zt-example"
         ],
         "title": "Branding URL Slack"
      },
      "platform_branding_logo": {
         "anyOf": [
            {
               "format": "uri",
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The URL to the platform's logo image.",
         "examples": [
            "https://cdn.example.com/logo.png"
         ],
         "title": "Platform Logo URL"
      },
      "platform_branding_marketing_site_url": {
         "anyOf": [
            {
               "format": "uri",
               "maxLength": 2083,
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The URL to the platform's marketing site.",
         "examples": [
            "https://www.example.com"
         ],
         "title": "Marketing Site URL"
      }
   }
}

Fields:
Validators:
field platform_branding_address1: str = '123 Main St, Anytown, USA'

The corporate address used for branding purposes throughout the platform.

This setting specifies the physical address of the organization or company that owns or operates the platform. It is used in various branding contexts, such as email templates, user interfaces, and documentation. :type: str :default: "123 Main St, Anytown, USA" :raises SmarterConfigurationError: If the value is not a string.

The corporate address used for branding purposes throughout the platform.

Validated by:
field platform_branding_address2: str | None = 'Suite 100'

The second line of the corporate address used for branding purposes throughout the platform.

This setting specifies the second line of the physical address of the organization or company that owns or operates the platform. It is used in various branding contexts, such as email templates, user interfaces, and documentation. :type: Optional[str] :default: "Suite 100" :raises SmarterConfigurationError: If the value is not a string.

The second line of the corporate address used for branding purposes throughout the platform.

Validated by:
field platform_branding_app_name: str = 'Smarter'

The application’s name, which prefixes the names of the platform’s Django apps in the admin and the web console: SMARTER_PLATFORM_BRANDING_APP_NAME.

Type:

str

Default:

"Smarter"

Raises:

SmarterConfigurationError – If the value is not a string.

The application’s name, which prefixes the names of the platform’s Django apps in the admin and the web console.

Validated by:
field platform_branding_blog_url: HttpUrl = HttpUrl('https://blog.smarter.sh/')

The product’s blog, e.g. its release announcements: SMARTER_PLATFORM_BRANDING_BLOG_URL.

Type:

HttpUrl

Default:

"https://blog.smarter.sh"

The product’s blog, e.g. its release announcements.

Validated by:
field platform_branding_cdn_url: HttpUrl = HttpUrl('https://cdn.smarter.sh/')

The CDN of the product’s own static assets, e.g. its logo and Open Graph image: SMARTER_PLATFORM_BRANDING_CDN_URL.

Type:

HttpUrl

Default:

"https://cdn.smarter.sh"

The CDN of the product’s own static assets, e.g. its logo and Open Graph image.

Validated by:
field platform_branding_city: str = 'Anytown'

The corporate city used for branding purposes throughout the platform.

This setting specifies the city of the physical address of the organization or company that owns or operates the platform. It is used in various branding contexts, such as email templates, user interfaces, and documentation. :type: str :default: "Anytown" :raises SmarterConfigurationError: If the value is not a string.

The corporate city used for branding purposes throughout the platform.

Validated by:
field platform_branding_contact_url: HttpUrl | None = HttpUrl('https://lawrencemcdaniel.com/')

The contact URL used for branding purposes throughout the platform.

This setting specifies the URL that users can visit to contact the organization or company that owns or operates the platform. It is used in various branding contexts, such as email templates, user interfaces, and documentation. :type: str :default: "https://lawrencemcdaniel.com/" :raises SmarterConfigurationError: If the value is not a string.

The contact URL used for branding purposes throughout the platform.

Validated by:
field platform_branding_corporate_name: str = 'Lawrence P. McDaniel'

The corporate name used for branding purposes throughout the platform.

This setting specifies the name of the organization or company that owns or operates the platform. It is used in various branding contexts, such as email templates, user interfaces, and documentation. :type: str :default: "Lawrence P. McDaniel" :raises SmarterConfigurationError: If the value is not a string.

The corporate name used for branding purposes throughout the platform.

Validated by:
field platform_branding_country: str = 'USA'

The corporate country used for branding purposes throughout the platform.

This setting specifies the country of the physical address of the organization or company that owns or operates the platform. It is used in various branding contexts, such as email templates, user interfaces, and documentation. :type: str :default: "USA" :raises SmarterConfigurationError: If the value is not a string.

The corporate country used for branding purposes throughout the platform.

Validated by:
field platform_branding_currency: str = 'USD'

The currency used for branding purposes throughout the platform.

This setting specifies the currency that is used in various branding contexts, such as email templates, user interfaces, and documentation. It can be used to indicate the currency in which prices, billing, or financial information is presented to users. :type: str :default: "USD" :raises SmarterConfigurationError: If the value is not a string.

The currency used for branding purposes throughout the platform.

Validated by:
field platform_branding_docs_url: HttpUrl = HttpUrl('https://docs.smarter.sh/')

The product’s documentation site, linked from the web console and the api: SMARTER_PLATFORM_BRANDING_DOCS_URL.

Type:

HttpUrl

Default:

"https://docs.smarter.sh"

The product’s documentation site, linked from the web console and the api.

Validated by:

The URL to the platform’s logo image.

This setting specifies the web address of the logo image used in the platform’s user interface. It should be a valid URL pointing to an external image resource accessible by the frontend.

Type:

Optional[AnyUrl]

Default:

/images/logo/smarter-crop.png on platform_branding_cdn_url. See derive_branding_defaults().

Raises:

SmarterConfigurationError – If the value is not a valid URL string.

The URL to the platform’s logo image.

Validated by:
field platform_branding_marketing_site_url: HttpUrl | None = None

The URL to the platform’s marketing site.

This setting specifies the web address of the marketing site associated with the platform. It should be a valid URL pointing to an external website.

Type:

Optional[httpHttpUrl]

Default:

https:// the root domain, e.g. https://example.com. See derive_branding_defaults().

Raises:

SmarterConfigurationError – If the value is not a valid URL string.

The URL to the platform’s marketing site.

Validated by:
field platform_branding_postal_code: str = '12345'

The corporate postal code used for branding purposes throughout the platform.

This setting specifies the postal code of the physical address of the organization or company that owns or operates the platform. It is used in various branding contexts, such as email templates, user interfaces, and documentation. :type: str :default: "12345" :raises SmarterConfigurationError: If the value is not a string.

The corporate postal code used for branding purposes throughout the platform.

Validated by:
field platform_branding_primary_contact: str = 'Lawrence McDaniel'

The name of the person who is the technical point of contact for this platform.

This setting names the person who hosts the platform and answers its users’ questions. The welcome email is written from this person, and signed with this name. :type: str :default: "Lawrence McDaniel" :raises SmarterConfigurationError: If the value is not a string.

The name of the person who is the technical point of contact for this platform.

Validated by:
field platform_branding_product_description: str = 'An open source, no-code AI authoring platform designed for instructional use.'

A one-sentence description of the product, shown in the web console and in page metadata: SMARTER_PLATFORM_BRANDING_PRODUCT_DESCRIPTION.

Type:

str

Default:

"An open source, no-code AI authoring platform designed for instructional use."

Raises:

SmarterConfigurationError – If the value is not a string.

A one-sentence description of the product, shown in the web console and in page metadata.

Validated by:
field platform_branding_product_name: str = 'The Smarter Project'

The product’s name, shown in the web console, emails and documentation: SMARTER_PLATFORM_BRANDING_PRODUCT_NAME.

Type:

str

Default:

"The Smarter Project"

Raises:

SmarterConfigurationError – If the value is not a string.

The product’s name, shown in the web console, emails and documentation.

Validated by:
field platform_branding_state: str = 'CA'

The corporate state used for branding purposes throughout the platform.

This setting specifies the state of the physical address of the organization or company that owns or operates the platform. It is used in various branding contexts, such as email templates, user interfaces, and documentation. :type: str :default: "CA" :raises SmarterConfigurationError: If the value is not a string.

The corporate state used for branding purposes throughout the platform.

Validated by:
field platform_branding_support_email: EmailStr = 'lpm0073@gmail.com'

The support email address used for branding purposes throughout the platform.

This setting specifies the email address that users can contact for support or assistance related to the platform. It is used in various branding contexts, such as email templates, user interfaces, and documentation. :type: EmailStr :default: "lpm0073@gmail.com" :raises SmarterConfigurationError: If the value is not a EmailStr.

The support email address used for branding purposes throughout the platform.

Validated by:
field platform_branding_support_hours: str = 'MON-FRI 9:00 AM - 5:00 PM GMT-6 (CST)'

The support hours used for branding purposes throughout the platform.

This setting specifies the hours during which support is available for users of the platform. It is used in various branding contexts, such as email templates, user interfaces, and documentation. :type: str :default: "MON-FRI 9:00 AM - 5:00 PM GMT-6 (CST)" :raises SmarterConfigurationError: If the value is not a string.

The support hours used for branding purposes throughout the platform.

Validated by:
field platform_branding_support_phone_number: str = '(###) 555-1212'

The support phone number used for branding purposes throughout the platform.

This setting specifies the phone number that users can call for support or assistance related to the platform. It is used in various branding contexts, such as email templates, user interfaces, and documentation. :type: str :default: "(###) 555-1212" :raises SmarterConfigurationError: If the value is not a string.

The support phone number used for branding purposes throughout the platform.

Validated by:
field platform_branding_timezone: str = 'America/Denver'

The timezone used for branding purposes throughout the platform.

This setting specifies the timezone that is used in various branding contexts, such as email templates, user interfaces, and documentation. It can be used to indicate the timezone in which dates and times are presented to users. :type: str :default: "America/Denver" :raises SmarterConfigurationError: If the value is not a string.

The timezone used for branding purposes throughout the platform.

Validated by:
field platform_branding_url_facebook: HttpUrl | None = HttpUrl('https://facebook.com/')

The Facebook URL used for branding purposes throughout the platform.

This setting specifies the Facebook page URL of the organization or company that owns or operates the platform. It is used in various branding contexts, such as email templates, user interfaces, and documentation. :type: Optional[HttpUrl] :default: "https://facebook.com" :raises SmarterConfigurationError: If the value is not a valid HttpUrl.

The Facebook URL used for branding purposes throughout the platform.

Validated by:
field platform_branding_url_linkedin: HttpUrl | None = HttpUrl('https://www.linkedin.com/in/lawrencemcdaniel/')

The LinkedIn URL used for branding purposes throughout the platform.

This setting specifies the LinkedIn profile URL of the organization or company that owns or operates the platform. It is used in various branding contexts, such as email templates, user interfaces, and documentation. :type: Optional[HttpUrl] :default: "https://www.linkedin.com/in/lawrencemcdaniel/" :raises SmarterConfigurationError: If the value is not a valid HttpUrl.

The LinkedIn URL used for branding purposes throughout the platform.

Validated by:
field platform_branding_url_slack: HttpUrl | None = HttpUrl('https://join.slack.com/t/thesmarterproject/shared_invite/zt-4f0t6v46q-e2c5Of4hS4fBr_XwfQARCw')

The invite link of the Slack workspace that the platform’s emails invite users to.

The welcome email links to it, and the Slack invitation email, which a Celery Beat task sends two days after the welcome email, is about it. The default is the invite link of The Smarter Project’s Slack workspace.

Type:

Optional[HttpUrl]

Default:

"https://join.slack.com/t/thesmarterproject/shared_invite/zt-4f0t6v46q-e2c5Of4hS4fBr_XwfQARCw"

Raises:

SmarterConfigurationError – If the value is not a valid HttpUrl.

The invite link of the Slack workspace that the platform’s emails invite users to.

Validated by:
field platform_branding_url_twitter: HttpUrl | None = HttpUrl('https://x.com/fullstackwlarry')

The Twitter URL used for branding purposes throughout the platform.

This setting specifies the Twitter profile URL of the organization or company that owns or operates the platform. It is used in various branding contexts, such as email templates, user interfaces, and documentation. :type: Optional[HttpUrl] :default: "https://x.com/fullstackwlarry" :raises SmarterConfigurationError: If the value is not a valid HttpUrl.

The Twitter URL used for branding purposes throughout the platform.

Validated by:
validator derive_branding_defaults  »  all fields[source]

Derive the logo and the marketing site’s url, unless they are set.

The logo is /images/logo/smarter-crop.png on the CDN, and the marketing site is https:// the root domain, which PlatformSettings holds.

Parameters:

data (object) – The values to validate: the constructor’s and the environment’s.

Return type:

object

Returns:

The values, with the derived defaults added.

validator validate_branding_address  »  platform_branding_address1[source]

Validates the branding_address1 field.

Parameters:

v (str | None) – The branding address value to validate.

Returns:

The validated branding address.

Return type:

str

validator validate_platform_branding_address2  »  platform_branding_address2[source]

Validates the branding_address2 field.

Parameters:

v (str | None) – The branding address line 2 value to validate.

Returns:

The validated branding address line 2.

Return type:

str | None

validator validate_platform_branding_app_name  »  platform_branding_app_name[source]

Validate platform_branding_app_name: an empty value is the default.

Parameters:

v (str | None) – The value.

Return type:

str

Returns:

The value, or the default.

Raises:

SmarterConfigurationError – If the value is not a string.

validator validate_platform_branding_blog_url  »  platform_branding_blog_url[source]

Validate platform_branding_blog_url: an empty value is the default.

Parameters:

v (HttpUrl | None) – The value.

Return type:

HttpUrl

Returns:

The value, or the default.

validator validate_platform_branding_cdn_url  »  platform_branding_cdn_url[source]

Validate platform_branding_cdn_url: an empty value is the default.

Parameters:

v (HttpUrl | None) – The value.

Return type:

HttpUrl

Returns:

The value, or the default.

validator validate_platform_branding_city  »  platform_branding_city[source]

Validates the branding_city field.

Parameters:

v (str | None) – The branding city value to validate.

Returns:

The validated branding city.

Return type:

str

validator validate_platform_branding_contact_url  »  platform_branding_contact_url[source]

Validates the branding_contact_url field.

Parameters:

v (HttpUrl | None) – The branding contact URL value to validate.

Returns:

The validated branding contact URL.

Return type:

HttpUrl | None

validator validate_platform_branding_corporate_name  »  platform_branding_corporate_name[source]

Validates the branding_corporate_name field.

Parameters:

v (str | None) – The branding corporate name value to validate.

Returns:

The validated branding corporate name.

Return type:

str

validator validate_platform_branding_country  »  platform_branding_country[source]

Validates the branding_country field.

Parameters:

v (str | None) – The branding country value to validate.

Returns:

The validated branding country.

Return type:

str

validator validate_platform_branding_currency  »  platform_branding_currency[source]

Validates the branding_currency field.

Parameters:

v (str | None) – The branding currency value to validate.

Returns:

The validated branding currency.

Return type:

str

validator validate_platform_branding_docs_url  »  platform_branding_docs_url[source]

Validate platform_branding_docs_url: an empty value is the default.

Parameters:

v (HttpUrl | None) – The value.

Return type:

HttpUrl

Returns:

The value, or the default.

Validates the logo field.

Parameters:

v (AnyUrl | None) – The logo value to validate.

Returns:

The validated logo.

Return type:

AnyUrl

validator validate_platform_branding_marketing_site_url  »  platform_branding_marketing_site_url[source]

Validates the marketing_site_url field.

Parameters:

v (HttpUrl | None) – The marketing site URL value to validate.

Returns:

The validated marketing site URL.

Return type:

HttpUrl

validator validate_platform_branding_postal_code  »  platform_branding_postal_code[source]

Validates the branding_postal_code field.

Parameters:

v (str | None) – The branding postal code value to validate.

Returns:

The validated branding postal code.

Return type:

str

validator validate_platform_branding_primary_contact  »  platform_branding_primary_contact[source]

Validates the branding_primary_contact field.

Parameters:

v (str | None) – The branding primary contact value to validate.

Returns:

The validated branding primary contact.

Return type:

str

validator validate_platform_branding_product_description  »  platform_branding_product_description[source]

Validate platform_branding_product_description: an empty value is the default.

Parameters:

v (str | None) – The value.

Return type:

str

Returns:

The value, or the default.

Raises:

SmarterConfigurationError – If the value is not a string.

validator validate_platform_branding_product_name  »  platform_branding_product_name[source]

Validate platform_branding_product_name: an empty value is the default.

Parameters:

v (str | None) – The value.

Return type:

str

Returns:

The value, or the default.

Raises:

SmarterConfigurationError – If the value is not a string.

validator validate_platform_branding_state  »  platform_branding_state[source]

Validates the branding_state field.

Parameters:

v (str | None) – The branding state value to validate.

Returns:

The validated branding state.

Return type:

str

validator validate_platform_branding_support_email  »  platform_branding_support_email[source]

Validates the branding_support_email field.

Parameters:

v (EmailStr | None) – The branding support email value to validate.

Returns:

The validated branding support email.

Return type:

EmailStr

validator validate_platform_branding_support_hours  »  platform_branding_support_hours[source]

Validates the branding_support_hours field.

Parameters:

v (str | None) – The branding support hours value to validate.

Returns:

The validated branding support hours.

Return type:

str

validator validate_platform_branding_support_phone_number  »  platform_branding_support_phone_number[source]

Validates the branding_support_phone_number field.

Parameters:

v (str | None) – The branding support phone number value to validate.

Returns:

The validated branding support phone number.

Return type:

str

validator validate_platform_branding_timezone  »  platform_branding_timezone[source]

Validates the branding_timezone field.

Parameters:

v (str | None) – The branding timezone value to validate.

Returns:

The validated branding timezone.

Return type:

str

validator validate_platform_branding_url_facebook  »  platform_branding_url_facebook[source]

Validates the branding_url_facebook field.

Parameters:

v (HttpUrl | None) – The branding URL Facebook value to validate.

Returns:

The validated branding URL Facebook.

Return type:

HttpUrl | None

validator validate_platform_branding_url_linkedin  »  platform_branding_url_linkedin[source]

Validates the branding_url_linkedin field.

Parameters:

v (HttpUrl | None) – The branding URL LinkedIn value to validate.

Returns:

The validated branding URL LinkedIn.

Return type:

HttpUrl | None

validator validate_platform_branding_url_slack  »  platform_branding_url_slack[source]

Validates the branding_url_slack field.

Parameters:

v (HttpUrl | None) – The Slack invite link to validate.

Returns:

The validated Slack invite link.

Return type:

HttpUrl | None

validator validate_platform_branding_url_twitter  »  platform_branding_url_twitter[source]

Validates the branding_url_twitter field.

Parameters:

v (HttpUrl | None) – The branding URL Twitter value to validate.

Returns:

The validated branding URL Twitter.

Return type:

HttpUrl | None

pydantic model smarter.common.conf.settings.cache.CacheSettings[source]

Redis’s password, and how long cached views, prompts, llmclients and responses are kept.

Show JSON schema
{
   "title": "CacheSettings",
   "description": "Redis's password, and how long cached views, prompts, llmclients and responses are kept.",
   "type": "object",
   "properties": {
      "subsystem_redis_username": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The Redis ACL user that this process authenticates as, or empty for Redis's default user.",
         "examples": [
            "tools"
         ],
         "title": "Redis Username"
      },
      "subsystem_redis_password": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The password of the platform's Redis: the Celery broker, the cache and the sessions.",
         "examples": [
            "your-redis-password"
         ],
         "title": "Redis Password"
      },
      "subsystem_cache_expiration": {
         "default": 60,
         "description": "The cache expiration time in seconds for cached data.",
         "exclusiveMinimum": 0,
         "title": "Cache Expiration",
         "type": "integer"
      },
      "subsystem_cache_chat_expiration": {
         "default": 300,
         "description": "The prompt cache expiration time in seconds for cached prompt data.",
         "exclusiveMinimum": 0,
         "title": "Prompt Cache Expiration",
         "type": "integer"
      },
      "subsystem_cache_prompt_response_expiration": {
         "default": 3600,
         "description": "Seconds to cache the LLM's answer to the first message of a conversation. 0 disables the cache.",
         "minimum": 0,
         "title": "Prompt Response Cache Expiration",
         "type": "integer"
      },
      "subsystem_cache_listview_expiration": {
         "default": 3600,
         "description": "The cache expiration time in seconds for the pages of the web console's list views.",
         "exclusiveMinimum": 0,
         "title": "List View Cache Expiration",
         "type": "integer"
      },
      "subsystem_cache_llm_client_expiration": {
         "default": 300,
         "description": "The llmclient cache expiration time in seconds for cached llmclient data.",
         "exclusiveMinimum": 0,
         "title": "LLMClient Cache Expiration",
         "type": "integer"
      }
   }
}

Fields:
Validators:
field subsystem_cache_chat_expiration: int = 300

The prompt cache expiration time in seconds for cached prompt data.

This setting defines how long cached prompt data should be considered valid before it is refreshed or invalidated. A shorter expiration time may lead to more frequent cache refreshes, while a longer expiration time can improve performance by reducing the number of cache lookups.

Type:

int

Default:

60 * 5

Raises:

SmarterConfigurationError – If the value is not a positive integer.

see: smarter.apps.prompt.models.PromptHelper

The prompt cache expiration time in seconds for cached prompt data.

Constraints:
  • gt = 0

Validated by:
field subsystem_cache_expiration: int = 60

Default cache expiration time for Django views that use page caching.

See: django.views.decorators.cache.cache_control and django.views.decorators.cache.cache_page

The cache expiration time in seconds for cached data. This setting defines how long cached data should be considered valid before it is refreshed or invalidated. A shorter expiration time may lead to more frequent cache refreshes, while a longer expiration time can improve performance by reducing the number of cache lookups. :type: int :default: 60 * 1 :raises SmarterConfigurationError: If the value is not a positive integer.

The cache expiration time in seconds for cached data.

Constraints:
  • gt = 0

Validated by:
field subsystem_cache_listview_expiration: int = 3600

The cache expiration time in seconds for the pages of the web console’s list views.

Each list api caches the pages that it returns, per user. Saving or deleting a resource makes its list’s cached pages stale at once (see smarter.lib.django.listview), so this expiration only bounds how long a change made without Django’s signals, such as a QuerySet.update(), can go unnoticed.

Type:

int

Default:

60 * 60

Raises:

SmarterConfigurationError – If the value is not a positive integer.

The cache expiration time in seconds for the pages of the web console’s list views.

Constraints:
  • gt = 0

Validated by:
field subsystem_cache_llm_client_expiration: int = 300

The llmclient cache expiration time in seconds for cached llmclient data.

This setting defines how long cached llmclient data should be considered valid before it is refreshed or invalidated. A shorter expiration time may lead to more frequent cache refreshes, while a longer expiration time can improve performance by reducing the number of cache lookups.

Type:

int

Default:

60 * 5

Raises:

SmarterConfigurationError – If the value is not a positive integer.

The llmclient cache expiration time in seconds for cached llmclient data.

Constraints:
  • gt = 0

Validated by:
field subsystem_cache_prompt_response_expiration: int = 3600

Seconds to cache the LLM’s answer to the first message of a conversation.

0 disables the cache.

A first message has no conversation before it, so the same message, sent to the same LLMClient, gets the same answer, e.g. one of the LLMClient’s appExamplePrompts. Later messages are never cached, because their answers depend on the conversation. See smarter.apps.provider.services.text_completion.lib.prompt_cache.

Type:

int

Default:

one hour

Raises:

SmarterConfigurationError – If the value is not a non-negative integer.

Seconds to cache the LLM’s answer to the first message of a conversation. 0 disables the cache.

Constraints:
  • ge = 0

Validated by:
field subsystem_redis_password: HeldBy(pods=frozenset({'worker-infrastructure', 'api', 'worker-extensions', 'beat', 'worker', 'job-backup', 'bastion', 'job-init', 'worker-tools', 'job-migrate'}))] = None

The password of the platform’s Redis, which holds the Celery broker, RedBeat’s schedule, the cache and the.

sessions.

Set it with SMARTER_SUBSYSTEM_REDIS_PASSWORD. On a cluster that smarter-infrastructure built, the Helm chart reads it from the Kubernetes Secret smarter-redis-password, which smarter-infrastructure generates, and gives the same Secret to its Redis. smarter.settings.base_aws builds the broker’s, RedBeat’s and the caches’ urls from it, and require_redis_password() refuses to start without it outside the local environment (ADR-030, rule 5).

In the local environment it defaults to the password of docker-compose.yml’s smarter-redis service. Elsewhere there is no default: a missing password, or a placeholder such as SET-ME-PLEASE, is None.

Type:

Optional[SecretStr]

Default:

"smarter" in the local environment, and None elsewhere. See derive_cache_defaults().

Raises:

SmarterConfigurationError – If the value is not a SecretStr.

The password of the platform’s Redis: the Celery broker, the cache and the sessions.

Constraints:
  • pods = frozenset({‘worker-infrastructure’, ‘api’, ‘worker-extensions’, ‘beat’, ‘worker’, ‘job-backup’, ‘bastion’, ‘job-init’, ‘worker-tools’, ‘job-migrate’})

Validated by:
field subsystem_redis_username: str | None = None

The Redis ACL user that this process authenticates as.

Every process but the tool worker uses Redis’s default user, which may do anything. The tool worker is given its own user, tools (RedisAclUsers.TOOL_WORKER), which may touch only its own queue, its results, Extensions’ archives and a few cache keys (ADR-030, rule 8), with subsystem_redis_password set to that user’s password.

Set it with SMARTER_SUBSYSTEM_REDIS_USERNAME.

Type:

Optional[str]

Default:

None, Redis’s default user.

Raises:

SmarterConfigurationError – If the value is not a string.

The Redis ACL user that this process authenticates as, or empty for Redis’s default user.

Validated by:
validator derive_cache_defaults  »  all fields[source]

Derive the local environment’s Redis password, unless it is set.

In the local environment, the password is docker-compose.yml’s smarter-redis service’s, smarter. Elsewhere there is no default.

Parameters:

data (object) – The values to validate: the constructor’s and the environment’s.

Return type:

object

Returns:

The values, with the derived default added in the local environment.

validator parse_subsystem_cache_chat_expiration  »  subsystem_cache_chat_expiration[source]

Validates the ‘cache_chat_expiration’ field.

Parameters:

v (int | str | None) – the cache_chat_expiration value to validate

Returns:

The validated cache_chat_expiration.

Return type:

int

validator parse_subsystem_cache_expiration  »  subsystem_cache_expiration[source]

Validates the ‘cache_expiration’ field.

Parameters:

v (int | str | None) – the cache_expiration value to validate

Returns:

The validated cache_expiration.

Return type:

int

validator parse_subsystem_cache_listview_expiration  »  subsystem_cache_listview_expiration[source]

Validates the ‘cache_listview_expiration’ field.

Parameters:

v (int | str | None) – the cache_listview_expiration value to validate

Returns:

The validated cache_listview_expiration.

Return type:

int

validator parse_subsystem_cache_llm_client_expiration  »  subsystem_cache_llm_client_expiration[source]

Validates the ‘cache_llm_client_expiration’ field.

Parameters:

v (int | str | None) – the cache_llm_client_expiration value to validate

Returns:

The validated cache_llm_client_expiration.

Return type:

int

validator parse_subsystem_cache_prompt_response_expiration  »  subsystem_cache_prompt_response_expiration[source]

Validates the ‘cache_prompt_response_expiration’ field.

Parameters:

v (int | str | None) – the cache_prompt_response_expiration value to validate

Returns:

The validated cache_prompt_response_expiration.

Return type:

int

validator validate_subsystem_redis_password  »  subsystem_redis_password[source]

Validate subsystem_redis_password.

Parameters:

v (SecretStr | str | None) – The password, or empty for the default.

Return type:

SecretStr | None

Returns:

The password, or None if it is missing or a placeholder.

Raises:

SmarterConfigurationError – If the value is not a SecretStr.

validator validate_subsystem_redis_username  »  subsystem_redis_username[source]

Validate subsystem_redis_username.

Parameters:

v (str | None) – The username, or empty for the default user.

Return type:

str | None

Returns:

The username, or None.

Raises:

SmarterConfigurationError – If the value is not a string.

pydantic model smarter.common.conf.settings.database.DatabaseSettings[source]

The platform’s MySQL (MariaDB) database.

Show JSON schema
{
   "title": "DatabaseSettings",
   "description": "The platform's MySQL (MariaDB) database.",
   "type": "object",
   "properties": {
      "subsystem_sql_root_username": {
         "default": "root",
         "description": "The database server's administrator, whom manage.py load_from_github --run_scripts passes to a repository's scripts.",
         "examples": [
            "root"
         ],
         "title": "MySQL Root Username",
         "type": "string"
      },
      "subsystem_sql_root_password": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The password of the database server's administrator, sql_root_username.",
         "examples": [
            "your-root-password"
         ],
         "title": "MySQL Root Password"
      },
      "subsystem_sql_backup_password": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The password of the read-only account that the nightly database backup dumps the database as.",
         "examples": [
            "your-backup-password"
         ],
         "title": "MySQL Backup Password"
      },
      "subsystem_sql_host": {
         "default": "smarter-mariadb",
         "description": "The host name of the platform's database server.",
         "examples": [
            "smarter-mariadb",
            "mysql.example.com"
         ],
         "title": "MySQL Host",
         "type": "string"
      },
      "subsystem_sql_port": {
         "default": 3306,
         "description": "The TCP port of the platform's database server.",
         "examples": [
            3306
         ],
         "maximum": 65535,
         "minimum": 1,
         "title": "MySQL Port",
         "type": "integer"
      },
      "subsystem_sql_database": {
         "default": "smarter",
         "description": "The name of the platform's database.",
         "examples": [
            "smarter"
         ],
         "title": "MySQL Database",
         "type": "string"
      },
      "subsystem_sql_user": {
         "default": "smarter",
         "description": "The database user that the platform connects as.",
         "examples": [
            "smarter"
         ],
         "title": "MySQL User",
         "type": "string"
      },
      "subsystem_sql_password": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The password of sql_user, the database user that the platform connects as.",
         "examples": [
            "your-database-password"
         ],
         "title": "MySQL Password"
      },
      "database_read_timeout": {
         "default": 0,
         "description": "The seconds that a query of the platform's database may wait for the server's reply before it fails. 0 for no timeout.",
         "minimum": 0,
         "title": "Database Read Timeout",
         "type": "integer"
      },
      "database_unavailable": {
         "default": false,
         "description": "True in a process that has no platform database: the tool worker. Waffle switches are then off, without a query.",
         "title": "Database Unavailable",
         "type": "boolean"
      }
   }
}

Fields:
Validators:
field database_read_timeout: int = 0

The seconds that a query of the platform’s database may wait for the server’s reply, and a write may.

wait to be sent, before it fails. 0, the default, is no timeout.

Without a timeout, a request whose query the database never answers holds its thread forever. The Helm chart sets it for the web server’s pods only: migrations and other management commands can legitimately run longer, and keep the default. Connecting always times out after smarter.settings.base.DATABASE_CONNECT_TIMEOUT seconds.

Set it with SMARTER_DATABASE_READ_TIMEOUT.

Type:

int

Default:

0 if it is not set.

Raises:

SmarterConfigurationError – If the value is not a non-negative integer.

The seconds that a query of the platform’s database may wait for the server’s reply before it fails. 0 for no timeout.

Constraints:
  • ge = 0

Validated by:
field database_unavailable: bool = False

True in a process that is not given the platform’s database: the tool worker, smarter-worker-tools.

The tool worker runs LLM tool calls without the database or the platform’s credentials (ADR-038). Its network policy doesn’t let it reach the database, so a query would wait for the connection to time out. With this setting, every waffle switch is off, and is never read from the database, so that a switched logger, which checks its switch on each log call, costs nothing.

Set it with SMARTER_DATABASE_UNAVAILABLE. The Helm chart sets it for the tool worker only.

Type:

bool

Default:

False

True in a process that has no platform database: the tool worker. Waffle switches are then off, without a query.

Validated by:
field subsystem_sql_backup_password: HeldBy(pods=frozenset({'job-backup', 'bastion', 'job-init'}))] = None

The password of the database’s read-only backup account, smarter_backup by default.

Set it with SMARTER_SUBSYSTEM_SQL_BACKUP_PASSWORD. The Helm chart’s init Job creates the account with it, and its nightly backup Job dumps the database as that account; until it is set, the backup dumps as the administrator, subsystem_sql_root_password. Only the chart’s shell scripts use it, not Smarter’s Python code: it is a setting so that the credentials map (smarter.common.conf.credentials) says which pods hold it, and the chart gives it to no other pod.

Type:

Optional[SecretStr]

Default:

None if it is not set.

Raises:

SmarterConfigurationError – If the value is not a SecretStr.

The password of the read-only account that the nightly database backup dumps the database as.

Constraints:
  • pods = frozenset({‘job-backup’, ‘bastion’, ‘job-init’})

Validated by:
field subsystem_sql_database: str = 'smarter'

The name of the platform’s database, Django’s DATABASES["default"]["NAME"].

Set it with SMARTER_SUBSYSTEM_SQL_DATABASE.

Type:

str

Default:

smarter if it is not set.

Raises:

SmarterConfigurationError – If the value is not a non-empty string.

The name of the platform’s database.

Validated by:
field subsystem_sql_host: str = 'smarter-mariadb'

The host name of the platform’s database server, Django’s DATABASES["default"]["HOST"].

Set it with SMARTER_SUBSYSTEM_SQL_HOST.

Type:

str

Default:

smarter-mariadb, the local docker-compose service, if it is not set.

Raises:

SmarterConfigurationError – If the value is not a non-empty string.

The host name of the platform’s database server.

Validated by:
field subsystem_sql_password: HeldBy(pods=frozenset({'worker-infrastructure', 'api', 'beat', 'worker', 'job-backup', 'bastion', 'job-init', 'job-migrate'}))] = None

The password of sql_user, Django’s DATABASES["default"]["PASSWORD"].

Set it with SMARTER_SUBSYSTEM_SQL_PASSWORD. In the local environment it defaults to the password of docker-compose.yml’s smarter-mariadb service. Elsewhere there is no default: a missing password, or a placeholder such as SET-ME-PLEASE, is None, and the platform can’t connect to its database.

Type:

Optional[SecretStr]

Default:

"smarter" in the local environment, and None elsewhere. See derive_database_defaults().

Raises:

SmarterConfigurationError – If the value is not a SecretStr.

The password of sql_user, the database user that the platform connects as.

Constraints:
  • pods = frozenset({‘worker-infrastructure’, ‘api’, ‘beat’, ‘worker’, ‘job-backup’, ‘bastion’, ‘job-init’, ‘job-migrate’})

Validated by:
field subsystem_sql_port: int = 3306

The TCP port of the platform’s database server, Django’s DATABASES["default"]["PORT"].

Set it with SMARTER_SUBSYSTEM_SQL_PORT.

Type:

int

Default:

3306 if it is not set.

Raises:

SmarterConfigurationError – If the value is not a port number, 1 to 65535.

The TCP port of the platform’s database server.

Constraints:
  • ge = 1

  • le = 65535

Validated by:
field subsystem_sql_root_password: HeldBy(pods=frozenset({'job-backup', 'bastion', 'job-init'}))] = None

The password of the database server’s administrator, sql_root_username.

Set it with SMARTER_SUBSYSTEM_SQL_ROOT_PASSWORD. manage.py load_from_github --run_scripts passes it to a repository’s scripts in the MYSQL_PWD environment variable, where the MariaDB and MySQL clients read it, which keeps it off the command line. Without it, the scripts don’t receive it.

Type:

Optional[SecretStr]

Default:

None if it is not set.

Raises:

SmarterConfigurationError – If the value is not a SecretStr.

The password of the database server’s administrator, sql_root_username.

Constraints:
  • pods = frozenset({‘job-backup’, ‘bastion’, ‘job-init’})

Validated by:
field subsystem_sql_root_username: str = 'root'

The database server’s administrator.

manage.py load_from_github --run_scripts passes it to a repository’s scripts, in SMARTER_DATABASE_ADMIN_USERNAME, e.g. to the Stackademy script that creates its course database and its users, so it needs a user that may. Set it with SMARTER_SUBSYSTEM_SQL_ROOT_USERNAME.

Type:

str

Default:

root if it is not set.

Raises:

SmarterConfigurationError – If the value is not a non-empty string.

The database server’s administrator, whom manage.py load_from_github –run_scripts passes to a repository’s scripts.

Validated by:
field subsystem_sql_user: str = 'smarter'

The database user that the platform connects as, Django’s DATABASES["default"]["USER"].

Set it with SMARTER_SUBSYSTEM_SQL_USER.

Type:

str

Default:

smarter if it is not set.

Raises:

SmarterConfigurationError – If the value is not a non-empty string.

The database user that the platform connects as.

Validated by:
validator derive_database_defaults  »  all fields[source]

Derive the local environment’s database password, unless it is set.

In the local environment, the password is docker-compose.yml’s smarter-mariadb service’s, smarter. Elsewhere there is no default.

Parameters:

data (object) – The values to validate: the constructor’s and the environment’s.

Return type:

object

Returns:

The values, with the derived default added in the local environment.

validator parse_database_read_timeout  »  database_read_timeout[source]

Validates the ‘database_read_timeout’ field.

Parameters:

v (int | str | None) – the database_read_timeout value to validate

Returns:

The validated database_read_timeout.

Return type:

int

validator validate_subsystem_sql_backup_password  »  subsystem_sql_backup_password[source]

Validates the sql_backup_password field.

Parameters:

v (SecretStr | None) – The password to validate.

Returns:

The validated password, or None if it is missing or a placeholder.

Return type:

SecretStr | None

validator validate_subsystem_sql_database  »  subsystem_sql_database[source]

Validates the sql_database field.

Parameters:

v (str | None) – The database name to validate.

Returns:

The validated database name.

Return type:

str

validator validate_subsystem_sql_host  »  subsystem_sql_host[source]

Validates the sql_host field.

Parameters:

v (str | None) – The host name to validate.

Returns:

The validated host name.

Return type:

str

validator validate_subsystem_sql_password  »  subsystem_sql_password[source]

Validates the sql_password field.

Parameters:

v (SecretStr | str | None) – The password to validate.

Returns:

The validated password, or None if it is missing or a placeholder.

Return type:

SecretStr | None

validator validate_subsystem_sql_port  »  subsystem_sql_port[source]

Validates the sql_port field.

Parameters:

v (int | str | None) – The port to validate, e.g. "3306" from an environment variable.

Returns:

The validated port.

Return type:

int

validator validate_subsystem_sql_root_password  »  subsystem_sql_root_password[source]

Validates the sql_root_password field.

Parameters:

v (SecretStr | None) – The password to validate.

Returns:

The validated password, or None if it is missing or a placeholder.

Return type:

SecretStr | None

validator validate_subsystem_sql_root_username  »  subsystem_sql_root_username[source]

Validates the sql_root_username field.

Parameters:

v (str | None) – The username to validate.

Returns:

The validated username.

Return type:

str

validator validate_subsystem_sql_user  »  subsystem_sql_user[source]

Validates the sql_user field.

Parameters:

v (str | None) – The user name to validate.

Returns:

The validated user name.

Return type:

str

pydantic model smarter.common.conf.settings.email.EmailSettings[source]

Outgoing email: SMTP, the administrator’s address, and the mailing list.

Show JSON schema
{
   "title": "EmailSettings",
   "description": "Outgoing email: SMTP, the administrator's address, and the mailing list.",
   "type": "object",
   "properties": {
      "subsystem_logging_loki_url": {
         "default": "",
         "description": "The base url of the Loki that stores the platform's pod logs, e.g. http://smarter-loki:3100. Empty: there is none.",
         "examples": [
            "http://smarter-loki:3100"
         ],
         "title": "Loki URL",
         "type": "string"
      },
      "overrides_file": {
         "default": "/home/smarter_user/overrides/settings.yaml",
         "description": "The path of the YAML file of overrides, which overwrite Smarter's Django settings.",
         "examples": [
            "/home/smarter_user/overrides/settings.yaml"
         ],
         "title": "Overrides File",
         "type": "string"
      },
      "bootstrap_secrets_dir": {
         "default": "/home/smarter_user/bootstrap-secrets",
         "description": "The folder of files from which the init Job creates Smarter Secrets, one per file.",
         "examples": [
            "/home/smarter_user/bootstrap-secrets"
         ],
         "title": "Bootstrap Secrets Folder",
         "type": "string"
      },
      "SERVICE_TYPE": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The kind of pod this process runs in, e.g. api or worker-tools. Empty: unknown.",
         "examples": [
            "api"
         ],
         "title": "Service Type"
      },
      "environment": {
         "default": "local",
         "description": "The deployment environment for the platform.",
         "examples": [
            "local",
            "alpha",
            "beta",
            "next",
            "prod"
         ],
         "title": "Deployment Environment",
         "type": "string"
      },
      "platform_subdomain": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "platform",
         "description": "The subdomain for the platform, used in constructing URLs and email addresses.",
         "examples": [
            "platform",
            "ubc"
         ],
         "title": "Platform Subdomain"
      },
      "platform_root_domain": {
         "default": "example.com",
         "description": "The root domain for the platform.",
         "examples": [
            "example.com"
         ],
         "title": "Root Domain",
         "type": "string"
      },
      "platform_settings_output": {
         "default": false,
         "description": "Flag to enable or disable output of settings for debugging purposes.",
         "examples": [
            true,
            false
         ],
         "title": "Settings Output",
         "type": "boolean"
      },
      "platform_shared_resource_identifier": {
         "default": "smarter",
         "description": "Smarter 1-word identifier to be used when naming any shared resource.",
         "examples": [
            "smarter",
            "mycompany",
            "myproject"
         ],
         "title": "Shared Resource Identifier",
         "type": "string"
      },
      "AWS_PROFILE": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The AWS profile to use for authentication. If present, this will take precedence over AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.",
         "examples": [
            "default",
            "smarter-profile"
         ],
         "title": "AWS Profile"
      },
      "AWS_ACCESS_KEY_ID": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The AWS access key ID for authentication. Used if AWS_PROFILE is not set. Masked by pydantic SecretStr.",
         "examples": [
            "^AKIA[0-9A-Z]{16}$"
         ],
         "title": "AWS Access Key ID"
      },
      "AWS_SECRET_ACCESS_KEY": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The AWS secret access key for authentication. Used if AWS_PROFILE is not set. Masked by pydantic SecretStr.",
         "examples": [
            "^[0-9a-zA-Z/+]{40}$"
         ],
         "title": "AWS Secret Access Key"
      },
      "aws_regions": {
         "default": [
            "us-east-1",
            "us-east-2",
            "us-west-1",
            "us-west-2",
            "af-south-1",
            "ap-east-1",
            "ap-northeast-1",
            "ap-northeast-2",
            "ap-northeast-3",
            "ap-south-1",
            "ap-south-2",
            "ap-southeast-1",
            "ap-southeast-2",
            "ap-southeast-3",
            "ap-southeast-4",
            "ap-southeast-5",
            "ap-southeast-7",
            "ca-central-1",
            "ca-west-1",
            "eu-central-1",
            "eu-central-2",
            "eu-north-1",
            "eu-south-1",
            "eu-south-2",
            "eu-west-1",
            "eu-west-2",
            "eu-west-3",
            "il-central-1",
            "me-central-1",
            "me-south-1",
            "mx-central-1",
            "sa-east-1"
         ],
         "description": "A list of AWS regions considered valid for this platform.",
         "examples": [
            "us-east-1",
            "us-west-2",
            "eu-west-1"
         ],
         "items": {
            "type": "string"
         },
         "title": "AWS Regions",
         "type": "array"
      },
      "AWS_REGION": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The single AWS region in which all AWS service clients will operate.",
         "examples": [
            "us-east-1",
            "us-west-2",
            "eu-west-1"
         ],
         "title": "AWS Region"
      },
      "platform_cloud_provider": {
         "default": "aws",
         "description": "The cloud provider of the platform's infrastructure services: DNS, TLS certificates, and the Kubernetes cluster's credentials.",
         "examples": [
            "aws",
            "memory"
         ],
         "title": "Cloud Provider",
         "type": "string"
      },
      "subsystem_k8s_cluster_name": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The name of the Kubernetes cluster that hosts the platform, e.g. its EKS cluster on AWS.",
         "examples": [
            "apps-hosting-service"
         ],
         "title": "Kubernetes Cluster Name"
      },
      "app_llmhost_node_role_arn": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The IAM role of the node groups that Smarter creates for LLMHosts.",
         "examples": [
            "arn:aws:iam::123456789012:role/eks-node-role"
         ],
         "title": "LLMHost Node Role ARN"
      },
      "app_llmhost_node_subnet_ids": {
         "default": [],
         "description": "The subnets of the node groups that Smarter creates for LLMHosts.",
         "examples": [
            [
               "subnet-0123456789abcdef0"
            ]
         ],
         "items": {
            "type": "string"
         },
         "title": "LLMHost Node Subnet IDs",
         "type": "array"
      },
      "platform_email_admin": {
         "default": "admin@example.com",
         "description": "The administrator email address used for system notifications and alerts.",
         "examples": [
            "admin@example.com"
         ],
         "format": "email",
         "title": "Administrator Email Address",
         "type": "string"
      },
      "subsystem_smtp_sender": {
         "anyOf": [
            {
               "format": "email",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The sender email address for SMTP emails.",
         "examples": [
            "sender@example.com"
         ],
         "title": "SMTP Sender Email Address"
      },
      "subsystem_smtp_from_email": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The From address of outgoing email. Set with SMARTER_SUBSYSTEM_SMTP_FROM_EMAIL.",
         "examples": [
            "no-reply@example.com"
         ],
         "title": "SMTP From Address"
      },
      "subsystem_smtp_host": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The SMTP server. Set with SMARTER_SUBSYSTEM_SMTP_HOST.",
         "examples": [
            "email-smtp.us-east-1.amazonaws.com"
         ],
         "title": "SMTP Host"
      },
      "subsystem_smtp_password": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The SMTP password for authentication. Assumed to be an AWS SES-generated IAM keypair secret.",
         "examples": [
            "your-smtp-password"
         ],
         "title": "SMTP Password"
      },
      "subsystem_smtp_port": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": 587,
         "description": "The SMTP port for sending emails.",
         "examples": [
            25,
            465,
            587
         ],
         "title": "SMTP Port Number"
      },
      "subsystem_smtp_use_ssl": {
         "anyOf": [
            {
               "type": "boolean"
            },
            {
               "type": "null"
            }
         ],
         "default": false,
         "description": "Whether to use SSL for SMTP connections.",
         "examples": [
            true,
            false
         ],
         "title": "SMTP Use SSL"
      },
      "subsystem_smtp_use_tls": {
         "anyOf": [
            {
               "type": "boolean"
            },
            {
               "type": "null"
            }
         ],
         "default": true,
         "description": "Whether to use TLS for SMTP connections.",
         "examples": [
            true,
            false
         ],
         "title": "SMTP Use TLS"
      },
      "subsystem_smtp_username": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The SMTP username for authentication. Assumed to be an AWS SES-generatred IAM keypair username.",
         "examples": [
            "your-smtp-username"
         ],
         "title": "SMTP Username"
      }
   }
}

Fields:
Validators:
field platform_email_admin: EmailStr = 'admin@example.com'

The administrator email address used for system notifications and alerts.

This email address is used as the primary contact for system notifications, alerts, and other administrative communications related to the platform.

Type:

str

Default:

"admin@example.com"

Raises:

SmarterConfigurationError – If the value is not a valid email address.

The administrator email address used for system notifications and alerts.

Validated by:
field subsystem_smtp_from_email: str | None = None

The email address that appears in the “From” field of outgoing SMTP emails.

Set it with SMARTER_SUBSYSTEM_SMTP_FROM_EMAIL. See derive_email_defaults().

Type:

Optional[str]

Default:

no-reply@ the platform’s domain, e.g. no-reply@platform.example.com

The From address of outgoing email. Set with SMARTER_SUBSYSTEM_SMTP_FROM_EMAIL.

Validated by:
field subsystem_smtp_host: str | None = None

The SMTP server that sends the platform’s email.

Set it with SMARTER_SUBSYSTEM_SMTP_HOST. See derive_email_defaults().

Type:

Optional[str]

Default:

the AWS Simple Email Service endpoint of aws_region, e.g. email-smtp.us-east-1.amazonaws.com, or None without a region

The SMTP server. Set with SMARTER_SUBSYSTEM_SMTP_HOST.

Validated by:
field subsystem_smtp_password: HeldBy(pods=frozenset({'worker-infrastructure', 'api', 'worker', 'job-backup', 'job-init'}))] = None

The SMTP password for authentication.

This setting provides the password used to authenticate with the SMTP server. It is required for sending emails through the SMTP server, which is optional.

Type:

Optional[SecretStr]

Default:

None if it is not set.

Raises:

SmarterConfigurationError – If the value is not a valid password.

The SMTP password for authentication. Assumed to be an AWS SES-generated IAM keypair secret.

Constraints:
  • pods = frozenset({‘worker-infrastructure’, ‘api’, ‘worker’, ‘job-backup’, ‘job-init’})

Validated by:
field subsystem_smtp_port: int | None = 587

The SMTP port for sending emails.

This setting specifies the port number used to connect to the SMTP server for sending outgoing emails.

Type:

Optional[int]

Default:

587

Raises:

SmarterConfigurationError – If the value is not a valid port number.

The SMTP port for sending emails.

Validated by:
field subsystem_smtp_sender: EmailStr | None = None

The sender email address for SMTP emails.

This setting specifies the email address that will appear as the sender in outgoing SMTP emails sent by the platform.

Type:

Optional[EmailStr]

Default:

admin@ the root domain, e.g. admin@example.com. See derive_email_defaults().

Raises:

SmarterConfigurationError – If the value is not a valid email address.

The sender email address for SMTP emails.

Validated by:
field subsystem_smtp_use_ssl: bool | None = False

Whether to use SSL for SMTP connections.

This setting indicates whether SSL (Secure Sockets Layer) should be used when connecting to the SMTP server for sending emails.

Type:

Optional[bool]

Default:

False

Raises:

SmarterConfigurationError – If the value is not a boolean.

Whether to use SSL for SMTP connections.

Validated by:
field subsystem_smtp_use_tls: bool | None = True

Whether to use TLS for SMTP connections.

This setting indicates whether TLS (Transport Layer Security) should be used when connecting to the SMTP server for sending emails.

Type:

Optional[bool]

Default:

True

Raises:

SmarterConfigurationError – If the value is not a boolean.

Whether to use TLS for SMTP connections.

Validated by:
field subsystem_smtp_username: HeldBy(pods=frozenset({'worker-infrastructure', 'api', 'worker', 'job-backup', 'job-init'}))] = None

The SMTP username for authentication.

This setting provides the username used to authenticate with the SMTP server. It is required for sending emails through the SMTP server, which is optional.

Type:

Optional[SecretStr]

Default:

None if it is not set.

Raises:

SmarterConfigurationError – If the value is not a string.

The SMTP username for authentication. Assumed to be an AWS SES-generatred IAM keypair username.

Constraints:
  • pods = frozenset({‘worker-infrastructure’, ‘api’, ‘worker’, ‘job-backup’, ‘job-init’})

Validated by:
validator derive_email_defaults  »  all fields[source]

Derive the SMTP sender, the From address and the host, unless they are set.

The sender is admin@ the root domain, the From address no-reply@ the platform’s domain, and the host the AWS Simple Email Service endpoint of aws_region, if it has one.

Parameters:

data (object) – The values to validate: the constructor’s and the environment’s.

Return type:

object

Returns:

The values, with the derived defaults added.

validator validate_platform_email_admin  »  platform_email_admin[source]

Validates the email_admin field.

Parameters:

v (EmailStr | None) – The administrator email address value to validate.

Returns:

The validated administrator email address.

Return type:

EmailStr

validator validate_subsystem_smtp_optional  »  subsystem_smtp_from_email, subsystem_smtp_host[source]

Validates the SMTP From address and host: None if it is missing, or a placeholder.

Parameters:

v (str | None) – The address, or the host.

Returns:

The validated value.

Return type:

str | None

validator validate_subsystem_smtp_password  »  subsystem_smtp_password[source]

Validates the smtp_password field.

Parameters:

v (SecretStr | None) – The SMTP password to validate.

Returns:

The validated SMTP password, or None if it is missing or a placeholder.

Return type:

SecretStr | None

validator validate_subsystem_smtp_port  »  subsystem_smtp_port[source]

Validates the smtp_port field.

Parameters:

v (int | str | None) – The SMTP port to validate.

Returns:

The validated SMTP port.

Return type:

int

validator validate_subsystem_smtp_sender  »  subsystem_smtp_sender[source]

Validates the smtp_sender field.

Parameters:

v (str | None) – The SMTP sender email address to validate.

Returns:

The validated SMTP sender email address.

Return type:

str

validator validate_subsystem_smtp_use_ssl  »  subsystem_smtp_use_ssl[source]

Validates the smtp_use_ssl field.

Parameters:

v (bool | str | None) – The SMTP use SSL flag to validate.

Returns:

The validated SMTP use SSL flag.

Return type:

bool

validator validate_subsystem_smtp_use_tls  »  subsystem_smtp_use_tls[source]

Validates the smtp_use_tls field.

Parameters:

v (bool | str | None) – The SMTP use TLS flag to validate.

Returns:

The validated SMTP use TLS flag.

Return type:

bool

validator validate_subsystem_smtp_username  »  subsystem_smtp_username[source]

Validates the smtp_username field.

Parameters:

v (SecretStr | None) – The SMTP username to validate.

Returns:

The validated SMTP username, or None if it is missing or a placeholder.

Return type:

SecretStr | None

pydantic model smarter.common.conf.settings.features.FeatureSettings[source]

Feature flags, debugging and logging.

Show JSON schema
{
   "title": "FeatureSettings",
   "description": "Feature flags, debugging and logging.",
   "type": "object",
   "properties": {
      "debug_mode": {
         "default": false,
         "description": "True if debug mode is enabled. This enables verbose logging and other debug features.",
         "title": "Debug Mode",
         "type": "boolean"
      },
      "dump_defaults": {
         "default": false,
         "description": "True if default values should be dumped for debugging purposes.",
         "title": "Dump Defaults",
         "type": "boolean"
      },
      "developer_mode": {
         "default": false,
         "description": "True if developer mode is enabled. Used as a means to configure a production Docker container to run locally for student use.",
         "title": "Developer Mode",
         "type": "boolean"
      },
      "app_dashboard_manifest_dropzone_enable": {
         "default": true,
         "description": "True if the file drop zone feature is enabled based on the current environment.",
         "title": "Enable File Drop Zone",
         "type": "boolean"
      },
      "app_connection_enable": {
         "default": true,
         "description": "True if the web console serves the Connection pages. Set with SMARTER_APP_CONNECTION_ENABLE.",
         "title": "Enable Connection",
         "type": "boolean"
      },
      "app_guardrail_enable": {
         "default": true,
         "description": "True if the web console serves the Guardrail pages. Set with SMARTER_APP_GUARDRAIL_ENABLE.",
         "title": "Enable Guardrail",
         "type": "boolean"
      },
      "app_llmclient_enable": {
         "default": true,
         "description": "True if the web console serves the LLMClient pages. Set with SMARTER_APP_LLMCLIENT_ENABLE.",
         "title": "Enable LLMClient",
         "type": "boolean"
      },
      "app_llmhost_enable": {
         "default": true,
         "description": "True if the web console serves the LLMHost pages. Set with SMARTER_APP_LLMHOST_ENABLE.",
         "title": "Enable LLMHost",
         "type": "boolean"
      },
      "app_llmtool_enable": {
         "default": true,
         "description": "True if the web console serves the LLMTool and Extension pages. Set with SMARTER_APP_LLMTOOL_ENABLE.",
         "title": "Enable LLMTool",
         "type": "boolean"
      },
      "app_mcpclient_enable": {
         "default": true,
         "description": "True if the web console serves the MCPClient pages. Set with SMARTER_APP_MCPCLIENT_ENABLE.",
         "title": "Enable MCPClient",
         "type": "boolean"
      },
      "app_orchestrator_enable": {
         "default": true,
         "description": "True if the web console serves the Orchestrator pages. Set with SMARTER_APP_ORCHESTRATOR_ENABLE.",
         "title": "Enable Orchestrator",
         "type": "boolean"
      },
      "app_provider_enable": {
         "default": true,
         "description": "True if the web console serves the Provider pages. Set with SMARTER_APP_PROVIDER_ENABLE.",
         "title": "Enable Provider",
         "type": "boolean"
      },
      "app_secret_enable": {
         "default": true,
         "description": "True if the web console serves the Secret pages. Set with SMARTER_APP_SECRET_ENABLE.",
         "title": "Enable Secret",
         "type": "boolean"
      },
      "app_vectorsearch_enable": {
         "default": true,
         "description": "True if the web console serves the VectorSearch pages. Set with SMARTER_APP_VECTORSEARCH_ENABLE.",
         "title": "Enable VectorSearch",
         "type": "boolean"
      },
      "app_vectorstore_enable": {
         "default": true,
         "description": "True if the vectorstore feature is enabled based on the current environment.",
         "title": "Enable Vectorstore",
         "type": "boolean"
      },
      "app_proxy_enable": {
         "default": true,
         "description": "True if the proxy feature is enabled based on the current environment.",
         "title": "Enable Proxy",
         "type": "boolean"
      },
      "app_dashboard_server_logs_enable": {
         "default": true,
         "description": "True if the terminal app feature is enabled based on the current environment.",
         "title": "Enabled Terminal App",
         "type": "boolean"
      },
      "app_dashboard_web_console_terminal_enable": {
         "default": false,
         "description": "True if superusers can open a bash shell inside the server's container from the web console's Terminal page. Off by default.",
         "title": "Enable Web Console Terminal",
         "type": "boolean"
      },
      "platform_static_files_on_cdn": {
         "default": false,
         "description": "True if the platform's static files, the web console's scripts among them, are uploaded to the environment's S3 bucket and served from its CDN. Off by default: the server serves them.",
         "title": "Static Files on the CDN",
         "type": "boolean"
      },
      "app_dashboard_passthrough_prompt_enable": {
         "default": true,
         "description": "True if the passthrough prompt feature is enabled based on the current environment.",
         "title": "Enable Passthrough Prompt",
         "type": "boolean"
      },
      "log_level": {
         "default": 20,
         "description": "The platform's Python logging level: DEBUG, INFO, WARNING, ERROR or CRITICAL, or its number. Set with SMARTER_LOG_LEVEL.",
         "examples": [
            "DEBUG",
            "INFO",
            30
         ],
         "maximum": 50,
         "minimum": 0,
         "title": "Logging Level",
         "type": "integer"
      },
      "verbose_logging": {
         "default": false,
         "description": "Whether to enable verbose logging for debugging purposes.",
         "examples": [
            true,
            false
         ],
         "title": "Verbose Logging",
         "type": "boolean"
      }
   }
}

Fields:
Validators:
field app_connection_enable: bool = True

True if the web console serves the Connection pages, under /connection/.

Type:

bool

Default:

True unless SMARTER_APP_CONNECTION_ENABLE is false.

True if the web console serves the Connection pages. Set with SMARTER_APP_CONNECTION_ENABLE.

Validated by:
field app_dashboard_manifest_dropzone_enable: bool = True

Determines if the file drop zone feature is enabled based on the current environment.

Returns:

True if the file drop zone is enabled, False otherwise.

Return type:

bool

True if the file drop zone feature is enabled based on the current environment.

Validated by:
field app_dashboard_passthrough_prompt_enable: bool = True

Determines if the passthrough prompt feature is enabled based on the current environment.

Returns:

True if the passthrough prompt is enabled, False otherwise.

Return type:

bool

True if the passthrough prompt feature is enabled based on the current environment.

Validated by:
field app_dashboard_server_logs_enable: bool = True

Determines if the terminal app feature is enabled based on the current environment.

Returns:

True if the terminal app is enabled, False otherwise.

Return type:

bool

True if the terminal app feature is enabled based on the current environment.

Validated by:
field app_dashboard_web_console_terminal_enable: bool = False

Determines whether superusers can open a bash shell inside the server’s container from the web console.

The shell runs as the server’s own operating system user, with the server’s environment and credentials, inside whichever server process (and so whichever pod or container) accepted the connection. See smarter.apps.dashboard.views.terminal_emulator.api.consumers.

Set with SMARTER_APP_DASHBOARD_WEB_CONSOLE_TERMINAL_ENABLE. Defaults to False.

Returns:

True if the web console terminal is enabled, False otherwise.

Return type:

bool

True if superusers can open a bash shell inside the server’s container from the web console’s Terminal page. Off by default.

Validated by:
field app_guardrail_enable: bool = True

True if the web console serves the Guardrail pages, under /guardrail/.

Type:

bool

Default:

True unless SMARTER_APP_GUARDRAIL_ENABLE is false.

True if the web console serves the Guardrail pages. Set with SMARTER_APP_GUARDRAIL_ENABLE.

Validated by:
field app_llmclient_enable: bool = True

True if the web console serves the LLMClient pages, under /llmclient/.

It doesn’t affect the chat and config endpoints of LLMClients on their custom domains.

Type:

bool

Default:

True unless SMARTER_APP_LLMCLIENT_ENABLE is false.

True if the web console serves the LLMClient pages. Set with SMARTER_APP_LLMCLIENT_ENABLE.

Validated by:
field app_llmhost_enable: bool = True

True if the web console serves the LLMHost pages, under /llmhost/.

Type:

bool

Default:

True unless SMARTER_APP_LLMHOST_ENABLE is false.

True if the web console serves the LLMHost pages. Set with SMARTER_APP_LLMHOST_ENABLE.

Validated by:
field app_llmtool_enable: bool = True

True if the web console serves the LLMTool pages, under /llm-tools/, and the Extension pages.

Type:

bool

Default:

True unless SMARTER_APP_LLMTOOL_ENABLE is false.

True if the web console serves the LLMTool and Extension pages. Set with SMARTER_APP_LLMTOOL_ENABLE.

Validated by:
field app_mcpclient_enable: bool = True

True if the web console serves the MCPClient pages, under /mcpclient/.

Type:

bool

Default:

True unless SMARTER_APP_MCPCLIENT_ENABLE is false.

True if the web console serves the MCPClient pages. Set with SMARTER_APP_MCPCLIENT_ENABLE.

Validated by:
field app_orchestrator_enable: bool = True

True if the web console serves the Orchestrator pages, under /orchestrator/.

Type:

bool

Default:

True unless SMARTER_APP_ORCHESTRATOR_ENABLE is false.

True if the web console serves the Orchestrator pages. Set with SMARTER_APP_ORCHESTRATOR_ENABLE.

Validated by:
field app_provider_enable: bool = True

True if the web console serves the Provider pages, under /provider/.

Type:

bool

Default:

True unless SMARTER_APP_PROVIDER_ENABLE is false.

True if the web console serves the Provider pages. Set with SMARTER_APP_PROVIDER_ENABLE.

Validated by:
field app_proxy_enable: bool = True

Determines if the proxy feature is enabled based on the current environment.

It mounts the Proxy web console pages, under /proxy/, and its api endpoints.

Returns:

True if the proxy is enabled, False otherwise.

Return type:

bool

True if the proxy feature is enabled based on the current environment.

Validated by:
field app_secret_enable: bool = True

True if the web console serves the Secret pages, under /secret/.

Type:

bool

Default:

True unless SMARTER_APP_SECRET_ENABLE is false.

True if the web console serves the Secret pages. Set with SMARTER_APP_SECRET_ENABLE.

Validated by:
field app_vectorsearch_enable: bool = True

True if the web console serves the VectorSearch pages, under /vectorsearch/.

Type:

bool

Default:

True unless SMARTER_APP_VECTORSEARCH_ENABLE is false.

True if the web console serves the VectorSearch pages. Set with SMARTER_APP_VECTORSEARCH_ENABLE.

Validated by:
field app_vectorstore_enable: bool = True

Determines if the vectorstore feature is enabled based on the current environment.

It mounts the VectorStore web console pages, under /vectorstore/, and its api endpoints.

Returns:

True if the vectorstore is enabled, False otherwise.

Return type:

bool

True if the vectorstore feature is enabled based on the current environment.

Validated by:
field debug_mode: bool = False

True if debug mode is enabled.

This enables verbose logging and other debug features.

When debug mode is enabled, the platform will log additional information useful for troubles hooting and development. This may include detailed error messages, stack traces, and other diagnostic data that can help identify issues during development or testing.

Type:

bool

Default:

False

Raises:

SmarterConfigurationError – If the value is not a boolean.

True if debug mode is enabled. This enables verbose logging and other debug features.

Validated by:
field developer_mode: bool = False

True if developer mode is enabled.

Used as a means to configure a production Docker container to run locally for student use. When developer mode is enabled, certain restrictions or configurations that are typical of a production environment may be relaxed or altered to facilitate local development and testing. This allows developers to work with a production-like setup without the constraints that would normally apply in a live environment.

Type:

bool

Default:

False

Raises:

SmarterConfigurationError – If the value is not a boolean.

True if developer mode is enabled. Used as a means to configure a production Docker container to run locally for student use.

Validated by:
field dump_defaults: bool = False

True if default values should be dumped for debugging purposes.

When enabled, the platform will log or output the default configuration values used during initialization. This can help developers and administrators understand the effective configuration of the system, especially when trouble shooting issues related to settings.

Type:

bool

Default:

False

Raises:

SmarterConfigurationError – If the value is not a boolean.

True if default values should be dumped for debugging purposes.

Validated by:
field log_level: int = 20

The platform’s Python logging level, e.g. logging.INFO.

Set it with SMARTER_LOG_LEVEL, a level’s name, e.g. DEBUG, or its number, e.g. 10. Unless it is set, it is derived from debug_mode: logging.DEBUG in debug mode, and logging.INFO otherwise. See derive_log_level().

Type:

int

Default:

logging.INFO, or logging.DEBUG in debug mode

Raises:

SmarterConfigurationError – If the value is neither a level’s name nor its number.

The platform’s Python logging level: DEBUG, INFO, WARNING, ERROR or CRITICAL, or its number. Set with SMARTER_LOG_LEVEL.

Constraints:
  • ge = 0

  • le = 50

Validated by:
field platform_static_files_on_cdn: bool = False

Determines whether the static files are served from the environment’s CDN, rather than by the server.

When true, initialize_platform uploads them to the environment’s S3 bucket, under static/, on each deployment, and STATIC_URL is the CDN’s, e.g. https://cdn.platform.example.com/static/. Pages, cookies and the api stay on the platform’s own host: only static files come from the CDN. It needs AWS, and is ignored, with a warning, without it. See ADR-035.

Set with SMARTER_PLATFORM_STATIC_FILES_ON_CDN. Defaults to False.

Returns:

True if the static files are served from the CDN, False otherwise.

Return type:

bool

True if the platform’s static files, the web console’s scripts among them, are uploaded to the environment’s S3 bucket and served from its CDN. Off by default: the server serves them.

Validated by:
field verbose_logging: bool = False

Whether to enable verbose logging for debugging purposes.

If True, enables verbose logging throughout the Smarter platform for debugging purposes. :type: bool :default: False :raises SmarterConfigurationError: If the value is not a boolean.

Whether to enable verbose logging for debugging purposes.

Validated by:
validator derive_log_level  »  all fields[source]

Derive log_level from debug_mode, unless it is set.

Parameters:

data (object) – The values to validate, before any field’s validators: the constructor’s and the environment’s.

Return type:

object

Returns:

The values, with log_level added when it is missing.

validator parse_app_dashboard_manifest_dropzone_enable  »  app_dashboard_manifest_dropzone_enable[source]

Validates the ‘app_dashboard_manifest_dropzone_enable’ field.

Parameters:

v (bool | str | None) – the app_dashboard_manifest_dropzone_enable value to validate

Returns:

The validated app_dashboard_manifest_dropzone_enable.

Return type:

bool

validator parse_app_dashboard_passthrough_prompt_enable  »  app_dashboard_passthrough_prompt_enable[source]

Validates the ‘app_dashboard_passthrough_prompt_enable’ field.

Parameters:

v (bool | str | None) – the app_dashboard_passthrough_prompt_enable value to validate

Returns:

The validated app_dashboard_passthrough_prompt_enable.

Return type:

bool

validator parse_app_dashboard_web_console_terminal_enable  »  app_dashboard_web_console_terminal_enable[source]

Validates the ‘app_dashboard_web_console_terminal_enable’ field.

Parameters:

v (bool | str | None) – the app_dashboard_web_console_terminal_enable value to validate

Returns:

The validated app_dashboard_web_console_terminal_enable.

Return type:

bool

validator parse_debug_mode  »  debug_mode[source]

Validates the ‘debug_mode’ field.

Parameters:

v (bool | str | None) – the debug_mode value to validate

Returns:

The validated debug_mode.

Return type:

bool

validator parse_developer_mode  »  developer_mode[source]

Validates the ‘developer_mode’ field.

Parameters:

v (bool | str | None) – the developer_mode value to validate

Returns:

The validated developer_mode.

Return type:

bool

validator parse_dump_defaults  »  dump_defaults[source]

Validates the ‘dump_defaults’ field.

Parameters:

v (bool | str | None) – the dump_defaults value to validate

Returns:

The validated dump_defaults.

Return type:

bool

validator parse_enable_sam_app  »  app_provider_enable, app_vectorsearch_enable, app_vectorstore_enable, app_proxy_enable, app_connection_enable, app_guardrail_enable, app_llmhost_enable, app_mcpclient_enable, app_secret_enable, app_llmclient_enable, app_llmtool_enable, app_orchestrator_enable[source]

Validate one of the SAM apps’ enable_<app> flags.

An empty value falls back to the field’s default, True for every one of them.

Parameters:
  • v (bool | str | None) – The value to validate.

  • info (ValidationInfo) – Pydantic’s validation info, which names the field.

Return type:

bool

Returns:

The validated flag.

Raises:

SmarterConfigurationError – If the value is neither a boolean nor a string.

validator parse_enabled_terminal_app  »  app_dashboard_server_logs_enable[source]

Validates the ‘app_dashboard_server_logs_enable’ field.

Parameters:

v (bool | str | None) – the app_dashboard_server_logs_enable value to validate

Returns:

The validated app_dashboard_server_logs_enable.

Return type:

bool

validator parse_log_level  »  log_level[source]

Validates the ‘log_level’ field: a level’s name, e.g. DEBUG, or its number.

Parameters:

v (int | str | None) – the level.

Returns:

The level’s number.

Return type:

int

validator parse_platform_static_files_on_cdn  »  platform_static_files_on_cdn[source]

Validates the ‘static_files_on_cdn’ field.

Parameters:

v (bool | str | None) – the static_files_on_cdn value to validate

Returns:

The validated static_files_on_cdn.

Return type:

bool

pydantic model smarter.common.conf.settings.integrations.IntegrationSettings[source]

The credentials of third-party services: Account Manager, GitHub, Slack, Stripe and social login.

Show JSON schema
{
   "title": "IntegrationSettings",
   "description": "The credentials of third-party services: Account Manager, GitHub, Slack, Stripe and social login.",
   "type": "object",
   "properties": {
      "account_manager_api_key": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The platform's key for Account Manager's subscription status api, which multitenant authentication sends as 'Authorization: Platform <key>'. Masked by pydantic SecretStr.",
         "examples": [
            "the key that Account Manager's create_platform_api_key command printed"
         ],
         "title": "Account Manager API Key"
      },
      "GITHUB_TOKEN": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The platform's GitHub token, from GITHUB_TOKEN, for the GitHub REST api requests that retrieve remote SkillPlugin skills, and that open the bug reports of the platform's staff. Masked by pydantic SecretStr.",
         "examples": [
            "ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
         ],
         "title": "GitHub Token"
      },
      "subsystem_social_auth_google_oauth2_key": {
         "default": "**********",
         "description": "The OAuth2 key for Google social authentication. Masked by pydantic SecretStr.",
         "examples": [
            "your-google-oauth2-key"
         ],
         "format": "password",
         "title": "Google OAuth2 Key",
         "type": "string",
         "writeOnly": true
      },
      "subsystem_social_auth_google_oauth2_secret": {
         "default": "**********",
         "description": "The OAuth2 secret for Google social authentication. Masked by pydantic SecretStr.",
         "examples": [
            "your-google-oauth2-secret"
         ],
         "format": "password",
         "title": "Google OAuth2 Secret",
         "type": "string",
         "writeOnly": true
      },
      "subsystem_social_auth_github_key": {
         "default": "**********",
         "description": "The OAuth2 key for GitHub social authentication. Masked by pydantic SecretStr.",
         "examples": [
            "your-github-oauth2-key"
         ],
         "format": "password",
         "title": "GitHub OAuth2 Key",
         "type": "string",
         "writeOnly": true
      },
      "subsystem_social_auth_github_secret": {
         "default": "**********",
         "description": "The OAuth2 secret for GitHub social authentication. Masked by pydantic SecretStr.",
         "examples": [
            "your-github-oauth2-secret"
         ],
         "format": "password",
         "title": "GitHub OAuth2 Secret",
         "type": "string",
         "writeOnly": true
      },
      "subsystem_social_auth_linkedin_oauth2_key": {
         "default": "**********",
         "description": "The OAuth2 key for LinkedIn social authentication. Masked by pydantic SecretStr.",
         "examples": [
            "your-linkedin-oauth2-key"
         ],
         "format": "password",
         "title": "LinkedIn OAuth2 Key",
         "type": "string",
         "writeOnly": true
      },
      "subsystem_social_auth_linkedin_oauth2_secret": {
         "default": "**********",
         "description": "The OAuth2 secret for LinkedIn social authentication. Masked by pydantic SecretStr.",
         "examples": [
            "your-linkedin-oauth2-secret"
         ],
         "format": "password",
         "title": "LinkedIn OAuth2 Secret",
         "type": "string",
         "writeOnly": true
      },
      "subsystem_slack_bot_token": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "A Slack app's bot token, xoxb-..., which the platform posts its Kubernetes jobs' logs to Slack with. Masked by pydantic SecretStr.",
         "examples": [
            "xoxb-xxxxxxxxxxxx-xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx"
         ],
         "title": "Slack Bot Token"
      },
      "subsystem_slack_app_token": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The Slack bot's app-level token, xapp-..., for Socket Mode. Only the Slack bot holds it.",
         "examples": [
            "xapp-1-xxxxxxxxxxx-xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
         ],
         "title": "Slack App Token"
      },
      "stripe_live_secret_key": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": "**********",
         "description": "DEPRECATED: The secret key for Stripe live environment.",
         "examples": [
            "sk_live_xxxxxxxxxxxxxxxxxxxxxxxx"
         ],
         "title": "Stripe Live Secret Key"
      },
      "stripe_test_secret_key": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": "**********",
         "description": "DEPRECATED: The secret key for Stripe test environment.",
         "examples": [
            "sk_test_xxxxxxxxxxxxxxxxxxxxxxxx"
         ],
         "title": "Stripe Test Secret Key"
      }
   }
}

Fields:
Validators:
field account_manager_api_key: HeldBy(pods=frozenset({'api'}))] = None

The platform’s key for Account Manager’s subscription status api.

A multitenant platform asks Account Manager, when a user signs in, whether the user has an active subscription (see smarter.lib.social_core.backends.multitenant). The key identifies the platform to Account Manager, which issues one per platform with its create_platform_api_key management command. It is sent only to Account Manager, as Authorization: Platform <key>.

Without a key, the platform asks without one, which Account Manager answers until its require_platform_key waffle switch is on.

Type:

Optional[SecretStr]

Default:

None if it is not set.

Raises:

SmarterConfigurationError – If the value is not a SecretStr.

The platform’s key for Account Manager’s subscription status api, which multitenant authentication sends as ‘Authorization: Platform <key>’. Masked by pydantic SecretStr.

Constraints:
  • pods = frozenset({‘api’})

Validated by:
field github_token: HeldBy(pods=frozenset({'worker', 'api'}))] = None

The platform’s GitHub token, from GITHUB_TOKEN.

GITHUB_TOKEN is the name that GitHub Actions and most tools use. It is used for two things:

  • SkillPlugin skills. A SkillPlugin whose skill is in a GitHub repository lists the skill’s files with the GitHub git trees api. Without a token those requests are anonymous, and GitHub limits them to 60 per hour per client IP address, which hosts that share an address, such as GitHub Actions runners, reach quickly. Any token raises the limit, with no scopes: in GitHub Actions, the workflow’s own GITHUB_TOKEN will do. See smarter.apps.llmtool.plugin.skill_sources.list_github_skill_files().

  • Bug reports. The MCPServer’s staff-only tool create_bug_report opens a GitHub issue in a repository of The Smarter Project with it, when Smarter Sysadmin has diagnosed a bug and the staff member agrees to report it. For that, it must be a classic personal access token, ghp_..., with the public_repo scope, and the issue is written as its owner. See smarter.apps.mcpserver.services.github.bug_reports.create_bug_report().

The token is sent only to api.github.com, and is never logged.

Type:

Optional[SecretStr]

Default:

None if it is not set.

Raises:

SmarterConfigurationError – If the value is not a SecretStr.

The platform’s GitHub token, from GITHUB_TOKEN, for the GitHub REST api requests that retrieve remote SkillPlugin skills, and that open the bug reports of the platform’s staff. Masked by pydantic SecretStr.

Constraints:
  • pods = frozenset({‘worker’, ‘api’})

Validated by:
field stripe_live_secret_key: Annotated[SecretStr | None, HeldBy(pods=frozenset())] = SecretStr('**********')

Deprecated since version 0.13.0.: This setting is deprecated and will be removed in a future release. Please use the new payment processing configuration settings.

The secret key for Stripe live environment. This setting provides the secret key used to authenticate with Stripe’s live environment. It is used for processing real transactions and payments.

Type:

Optional[str]

Default:

not set, the SET-ME-PLEASE placeholder

Raises:

SmarterConfigurationError – If the value is not a string.

DEPRECATED: The secret key for Stripe live environment.

Constraints:
  • pods = frozenset()

Validated by:
field stripe_test_secret_key: Annotated[SecretStr | None, HeldBy(pods=frozenset())] = SecretStr('**********')

Deprecated since version 0.13.0.: This setting is deprecated and will be removed in a future release. Please use the new payment processing configuration settings.

The secret key for Stripe test environment. This setting provides the secret key used to authenticate with Stripe’s test environment. It is used for processing test transactions and payments.

Type:

Optional[str]

Default:

not set, the SET-ME-PLEASE placeholder

Raises:

SmarterConfigurationError – If the value is not a string.

DEPRECATED: The secret key for Stripe test environment.

Constraints:
  • pods = frozenset()

Validated by:
field subsystem_slack_app_token: Annotated[SecretStr | None, HeldBy(pods=frozenset())] = None

The Slack bot’s app-level token, xapp-..., with which it connects to Slack in Socket Mode.

Set it with SMARTER_SUBSYSTEM_SLACK_APP_TOKEN. Only the optional Slack bot, the Helm chart’s slack-bot subchart, uses it, from its own Secret, <appName>-env-slack-bot. No kind of Smarter pod holds it (HeldBy()): it is a setting so that the credentials map (smarter.common.conf.credentials) keeps it out of every pod’s environment.

Type:

Optional[SecretStr]

Default:

None if it is not set.

Raises:

SmarterConfigurationError – If the value is not a SecretStr.

The Slack bot’s app-level token, xapp-…, for Socket Mode. Only the Slack bot holds it.

Constraints:
  • pods = frozenset()

Validated by:
field subsystem_slack_bot_token: HeldBy(pods=frozenset({'job-backup', 'job-init'}))] = None

A Slack app’s bot token, xoxb-..., for the platform’s Slack service.

The Helm chart’s init Job and nightly database backup post their outcome, and their log, to a Slack channel with it, when the chart’s databaseInit.notifySlackChannel or databaseScheduledBackup.notifySlackChannel names one. The bot needs the scopes chat:write and files:write, and must be a member of the channel. The optional Slack bot, the Helm chart’s slack-bot subchart, reads the same token from a Secret of its own, <appName>-env-slack-bot, which holds only its two tokens.

The token is sent only to slack.com. See smarter.apps.infrastructure.services.slack.SlackWebApiService.

Type:

Optional[SecretStr]

Default:

None if it is not set.

Raises:

SmarterConfigurationError – If the value is not a SecretStr.

A Slack app’s bot token, xoxb-…, which the platform posts its Kubernetes jobs’ logs to Slack with. Masked by pydantic SecretStr.

Constraints:
  • pods = frozenset({‘job-backup’, ‘job-init’})

Validated by:
field subsystem_social_auth_github_key: HeldBy(pods=frozenset({'api'}))] = SecretStr('**********')

The OAuth2 key for GitHub social authentication.

Masked by pydantic SecretStr. This setting provides the OAuth2 client ID used for GitHub social authentication. It is required for enabling users to log in using their GitHub accounts.

Type:

SecretStr

Default:

not set, the SET-ME-PLEASE placeholder

Raises:

SmarterConfigurationError – If the value is not a valid OAuth2 client ID

The OAuth2 key for GitHub social authentication. Masked by pydantic SecretStr.

Constraints:
  • pods = frozenset({‘api’})

Validated by:
field subsystem_social_auth_github_secret: HeldBy(pods=frozenset({'api'}))] = SecretStr('**********')

The OAuth2 secret for GitHub social authentication.

Masked by pydantic SecretStr. This setting provides the OAuth2 client secret used for GitHub social authentication. It is required for enabling users to log in using their GitHub accounts.

Type:

SecretStr

Default:

not set, the SET-ME-PLEASE placeholder

Raises:

SmarterConfigurationError – If the value is not a valid OAuth2 client secret

The OAuth2 secret for GitHub social authentication. Masked by pydantic SecretStr.

Constraints:
  • pods = frozenset({‘api’})

Validated by:
field subsystem_social_auth_google_oauth2_key: HeldBy(pods=frozenset({'api'}))] = SecretStr('**********')

The OAuth2 key for Google social authentication.

Masked by pydantic SecretStr. This setting provides the OAuth2 client ID used for Google social authentication. It is required for enabling users to log in using their Google accounts.

Type:

SecretStr

Default:

not set, the SET-ME-PLEASE placeholder

Raises:

SmarterConfigurationError – If the value is not a valid OAuth2 client ID.

The OAuth2 key for Google social authentication. Masked by pydantic SecretStr.

Constraints:
  • pods = frozenset({‘api’})

Validated by:
field subsystem_social_auth_google_oauth2_secret: HeldBy(pods=frozenset({'api'}))] = SecretStr('**********')

The OAuth2 secret for Google social authentication.

Masked by pydantic SecretStr. This setting provides the OAuth2 client secret used for Google social authentication. It is required for enabling users to log in using their Google accounts.

Type:

SecretStr

Default:

not set, the SET-ME-PLEASE placeholder

Raises:

SmarterConfigurationError – If the value is not a valid OAuth2 client secret

The OAuth2 secret for Google social authentication. Masked by pydantic SecretStr.

Constraints:
  • pods = frozenset({‘api’})

Validated by:
field subsystem_social_auth_linkedin_oauth2_key: HeldBy(pods=frozenset({'api'}))] = SecretStr('**********')

Deprecated since version 0.13.35.: This setting is deprecated and will be removed in a future release. LinkedIn social authentication is no longer supported or recommended for new deployments.

The OAuth2 key for LinkedIn social authentication. Masked by pydantic SecretStr. This setting provides the OAuth2 client ID used for LinkedIn social authentication. It was required for enabling users to log in using their LinkedIn accounts.

Type:

SecretStr

Default:

not set, the SET-ME-PLEASE placeholder

Raises:

SmarterConfigurationError – If the value is not a valid OAuth2 client ID

The OAuth2 key for LinkedIn social authentication. Masked by pydantic SecretStr.

Constraints:
  • pods = frozenset({‘api’})

Validated by:
field subsystem_social_auth_linkedin_oauth2_secret: HeldBy(pods=frozenset({'api'}))] = SecretStr('**********')

Deprecated since version 0.13.35.: This setting is deprecated and will be removed in a future release. LinkedIn social authentication is no longer supported or recommended for new deployments.

The OAuth2 secret for LinkedIn social authentication. Masked by pydantic SecretStr. This setting provides the OAuth2 client secret used for LinkedIn social authentication. It was required for enabling users to log in using their LinkedIn accounts.

Type:

SecretStr

Default:

not set, the SET-ME-PLEASE placeholder

Raises:

SmarterConfigurationError – If the value is not a valid OAuth2 client secret

The OAuth2 secret for LinkedIn social authentication. Masked by pydantic SecretStr.

Constraints:
  • pods = frozenset({‘api’})

Validated by:
validator validate_account_manager_api_key  »  account_manager_api_key[source]

Validates the account_manager_api_key field.

Parameters:

v (SecretStr | None) – The key to validate.

Returns:

The validated key, or None if it is missing or a placeholder.

Return type:

SecretStr | None

validator validate_github_token  »  github_token[source]

Validates the github_token field.

Parameters:

v (SecretStr | None) – The GitHub token to validate.

Returns:

The validated GitHub token, or None if it is missing or a placeholder.

Return type:

SecretStr | None

validator validate_stripe_live_secret_key  »  stripe_live_secret_key[source]

Validates the stripe_live_secret_key field.

Parameters:

v (SecretStr | None) – The Stripe live secret key to validate.

Returns:

The validated Stripe live secret key.

Return type:

SecretStr

validator validate_stripe_test_secret_key  »  stripe_test_secret_key[source]

Validates the stripe_test_secret_key field.

Parameters:

v (SecretStr | None) – The Stripe test secret key to validate.

Returns:

The validated Stripe test secret key.

Return type:

SecretStr

validator validate_subsystem_slack_app_token  »  subsystem_slack_app_token[source]

Validates the slack_app_token field.

Parameters:

v (SecretStr | None) – The Slack app token to validate.

Returns:

The validated Slack app token, or None if it is missing or a placeholder.

Return type:

SecretStr | None

validator validate_subsystem_slack_bot_token  »  subsystem_slack_bot_token[source]

Validates the slack_bot_token field.

Parameters:

v (SecretStr | None) – The Slack bot token to validate.

Returns:

The validated Slack bot token, or None if it is missing or a placeholder.

Return type:

SecretStr | None

validator validate_subsystem_social_auth_github_key  »  subsystem_social_auth_github_key[source]

Validates the social_auth_github_key field.

Parameters:

v (SecretStr | None) – The GitHub OAuth2 key value to validate.

Returns:

The validated GitHub OAuth2 key.

Return type:

SecretStr

validator validate_subsystem_social_auth_github_secret  »  subsystem_social_auth_github_secret[source]

Validates the social_auth_github_secret field.

Parameters:

v (SecretStr | None) – The GitHub OAuth2 secret value to validate.

Returns:

The validated GitHub OAuth2 secret.

Return type:

SecretStr

validator validate_subsystem_social_auth_google_oauth2_key  »  subsystem_social_auth_google_oauth2_key[source]

Validates the social_auth_google_oauth2_key field.

Parameters:

v (SecretStr | None) – The Google OAuth2 key value to validate.

Returns:

The validated Google OAuth2 key.

Return type:

SecretStr

validator validate_subsystem_social_auth_google_oauth2_secret  »  subsystem_social_auth_google_oauth2_secret[source]

Validates the social_auth_google_oauth2_secret field.

Parameters:

v (SecretStr | None) – The Google OAuth2 secret value to validate.

Returns:

The validated Google OAuth2 secret.

Return type:

SecretStr

validator validate_subsystem_social_auth_linkedin_oauth2_key  »  subsystem_social_auth_linkedin_oauth2_key[source]

Validates the social_auth_linkedin_oauth2_key field.

Parameters:

v (SecretStr | None) – The LinkedIn OAuth2 key value to validate.

Returns:

The validated LinkedIn OAuth2 key.

Return type:

SecretStr

validator validate_subsystem_social_auth_linkedin_oauth2_secret  »  subsystem_social_auth_linkedin_oauth2_secret[source]

Validates the social_auth_linkedin_oauth2_secret field.

Parameters:

v (SecretStr | None) – The LinkedIn OAuth2 secret value to validate.

Returns:

The validated LinkedIn OAuth2 secret.

Return type:

SecretStr

pydantic model smarter.common.conf.settings.llm.LLMSettings[source]

LLM defaults, prompts, tools, plugins, extensions and the MCP server.

Show JSON schema
{
   "title": "LLMSettings",
   "description": "LLM defaults, prompts, tools, plugins, extensions and the MCP server.",
   "type": "object",
   "properties": {
      "max_tool_rounds": {
         "default": 5,
         "description": "The most requests of one prompt that offer the LLM its tools.",
         "minimum": 1,
         "title": "Max Tool Rounds",
         "type": "integer"
      },
      "prompt_history_max_age": {
         "default": 90,
         "description": "Days to keep chat sessions and their prompt history before they are deleted.",
         "minimum": 1,
         "title": "Prompt History Max Age",
         "type": "integer"
      },
      "app_llmtool_plugin_max_data_results": {
         "default": 50,
         "description": "A global maximum number of data row results that can be returned by any Smarter plugin.",
         "exclusiveMinimum": 0,
         "title": "Plugin Max Data Results",
         "type": "integer"
      },
      "app_llmtool_extension_registry_url": {
         "default": "https://smarter-sh.github.io/extensions-registry/index.json",
         "description": "The url of the Smarter Extension registry's signed index, index.json.",
         "examples": [
            "https://smarter-sh.github.io/extensions-registry/index.json"
         ],
         "title": "Extension Registry URL",
         "type": "string"
      },
      "app_llmtool_extension_registry_public_key": {
         "default": "",
         "description": "The base64 Ed25519 public key that verifies the extension registry's index. Empty disables the registry.",
         "title": "Extension Registry Public Key",
         "type": "string"
      },
      "app_mcpserver_rate_limit": {
         "default": 1200,
         "description": "The maximum number of requests per minute that one client IP address may send to the MCPServer's endpoints. 0 disables the limit.",
         "minimum": 0,
         "title": "MCP Server Rate Limit",
         "type": "integer"
      },
      "llm_default_provider": {
         "default": "openai",
         "description": "The default LLM provider to use for language model interactions.",
         "examples": [
            "openai",
            "anthropic",
            "gemini",
            "llama"
         ],
         "title": "Default LLM Provider",
         "type": "string"
      },
      "llm_default_model": {
         "default": "gpt-6-luna",
         "description": "The default model of the default LLM provider, for plugins whose manifests don't name one.",
         "examples": [
            "gpt-6-luna"
         ],
         "title": "Default LLM Model",
         "type": "string"
      },
      "llm_default_system_role": {
         "default": "You are a helpful llmclient. When given the opportunity to utilize function calling, you should always do so. This will allow you to provide the best possible responses to the user. If you are unable to provide a response, you should prompt the user for more information. If you are still unable to provide a response, you should inform the user that you are unable to help them at this time.",
         "description": "The default system role prompt to use for language model interactions.",
         "examples": [
            "You are a helpful llmclient..."
         ],
         "title": "Default LLM System Role",
         "type": "string"
      },
      "llm_default_temperature": {
         "default": 1.0,
         "description": "The default temperature to use for language model interactions.",
         "examples": [
            0.0,
            0.5,
            1.0
         ],
         "title": "Default LLM Temperature",
         "type": "number"
      },
      "llm_default_max_tokens": {
         "default": 2048,
         "description": "The default maximum number of tokens to generate for language model interactions.",
         "examples": [
            256,
            512,
            1024,
            2048
         ],
         "minimum": 1,
         "title": "Default LLM Max Tokens",
         "type": "integer"
      },
      "prompt_threads": {
         "default": 32,
         "description": "The threads in each web server process that run streamed chat prompts.",
         "minimum": 1,
         "title": "Prompt Threads",
         "type": "integer"
      }
   }
}

Fields:
Validators:
field app_llmtool_extension_registry_public_key: str = ''

The Ed25519 public key, base64, that verifies the signature of the extension registry’s index.

It is public, not a secret. While it is empty, the registry is disabled: extensions can only be installed from uploaded archives, and updates are not checked. :type: str :default: ""

The base64 Ed25519 public key that verifies the extension registry’s index. Empty disables the registry.

field app_llmtool_extension_registry_url: str = 'https://smarter-sh.github.io/extensions-registry/index.json'

The url of the Smarter Extension registry’s index.

The registry lists the extensions that administrators may install from the Django admin console, their versions, and their publishers’ trust badges. The platform checks it daily for updates to installed extensions. Its signature, at the same url with .sig appended, is verified with extension_registry_public_key. :type: str :default: "https://smarter-sh.github.io/extensions-registry/index.json"

The url of the Smarter Extension registry’s signed index, index.json.

Validated by:
field app_llmtool_plugin_max_data_results: int = 50

A global maximum number of data row results that can be returned by any Smarter plugin.

This setting helps to prevent excessive data retrieval that could impact performance or lead to resource exhaustion. Plugins should respect this limit when querying data sources and returning results to ensure efficient operation of the platform. :type: int :default: 50 :raises SmarterConfigurationError: If the value is not a positive integer.

A global maximum number of data row results that can be returned by any Smarter plugin.

Constraints:
  • gt = 0

Validated by:
field app_mcpserver_rate_limit: int = 1200

The maximum number of requests per minute that one client IP address may send to the MCPServer’s endpoints.

The MCPServer, smarter.apps.mcpserver, serves its public tools without authentication, so the limit protects the platform’s database from a client that floods it. Requests beyond the limit are answered 429 Too Many Requests until the minute ends. The platform’s own MCPClients count too: they connect from the platform’s egress addresses, and each tool call is about three requests, so set the limit well above the platform’s own traffic. 0 disables the limit. :type: int :default: 1200 :raises SmarterConfigurationError: If the value is not a non-negative integer.

The maximum number of requests per minute that one client IP address may send to the MCPServer’s endpoints. 0 disables the limit.

Constraints:
  • ge = 0

Validated by:
field llm_default_max_tokens: int = 2048

The default maximum number of tokens to generate for language model interactions.

This setting specifies the upper limit on the number of tokens that the language model can generate in response to a single request. It helps control the length of the output and manage resource usage.

Type:

int

Default:

2048

Raises:

SmarterConfigurationError – If the value is not a positive integer.

The default maximum number of tokens to generate for language model interactions.

Constraints:
  • ge = 1

Validated by:
field llm_default_model: str = 'gpt-6-luna'

The model of llm_default_provider that a plugin’s prompt uses when its manifest names none.

Type:

str

Default:

"gpt-6-luna"

Raises:

SmarterConfigurationError – If the value is not a non-empty string.

The default model of the default LLM provider, for plugins whose manifests don’t name one.

Validated by:
field llm_default_provider: str = 'openai'

The default LLM provider to use for language model interactions.

This setting specifies which language model provider should be used by default for processing natural language tasks. It determines the backend service that will handle requests for language generation, understanding, and other related functions.

Type:

str

Default:

"openai"

Raises:

SmarterConfigurationError – If the value is not a valid LLM provider name

The default LLM provider to use for language model interactions.

Validated by:
field llm_default_system_role: str = 'You are a helpful llmclient. When given the opportunity to utilize function calling, you should always do so. This will allow you to provide the best possible responses to the user. If you are unable to provide a response, you should prompt the user for more information. If you are still unable to provide a response, you should inform the user that you are unable to help them at this time.'

The default system role prompt to use for language model interactions.

This setting provides the default system role prompt that guides the behavior of the language model during interactions. It helps define the context and tone of the responses generated by the model.

Type:

str

Default:

"You are a helpful llmclient. ...", which asks the LLM to call its tools

Raises:

SmarterConfigurationError – If the value is not a string.

The default system role prompt to use for language model interactions.

Validated by:
field llm_default_temperature: float = 1.0

The default temperature to use for language model interactions.

This setting controls the randomness of the language model’s output. A lower temperature (e.g., 0.0) results in more deterministic and focused responses, while a higher temperature (e.g., 1.0) produces more diverse and creative outputs.

Type:

float

Default:

1.0

Raises:

SmarterConfigurationError – If the value is not a float between 0.

The default temperature to use for language model interactions.

Validated by:
field max_tool_rounds: int = 5

The most requests of one prompt that offer the LLM its tools.

An LLM often needs more than one round of tool calls, e.g. a forecast, and then an image search with the forecast’s place, or a chain of MCP tool calls, each using the last one’s result. One round can hold several tool calls. After this many requests with tools, the LLM is sent the tool results without tools, so that it answers with what it has.

Type:

int

Default:

5

Raises:

SmarterConfigurationError – If the value is not a positive integer.

see: smarter.apps.provider.services.text_completion.lib.openai_compatible_chat_provider.OpenAISmarterClient.handler()

The most requests of one prompt that offer the LLM its tools.

Constraints:
  • ge = 1

Validated by:
field prompt_history_max_age: int = 90

Days to keep chat sessions and their prompt history before they are deleted.

Every prompt of a chat session (a Prompt) saves a PromptHistory row with the request, the response and the conversation’s messages, plus a PromptToolCall or PromptPluginUsage row for each tool or plugin it used. Celery Beat runs purge_prompt_history() once a day, which deletes these rows when they are older than this, then the sessions that are older than this and have none left. A session that is still in use keeps its recent rows.

Set it with SMARTER_PROMPT_HISTORY_MAX_AGE.

Type:

int

Default:

90

Raises:

SmarterConfigurationError – If the value is not a positive integer.

Days to keep chat sessions and their prompt history before they are deleted.

Constraints:
  • ge = 1

Validated by:
field prompt_threads: int = 32

The threads in each web server process that run streamed chat prompts, at most.

A prompt holds its thread for as long as it runs, mostly waiting on the LLM and its tools, so the threads are cheap. A process runs this many prompts at once, and queues the next ones. The pool is the prompts’ own, apart from the event loop’s default executor, where Django renders error pages and asyncio resolves host names. See smarter.apps.prompt.progress.prompt_executor().

Set it with SMARTER_PROMPT_THREADS.

Type:

int

Default:

32 if it is not set.

Raises:

SmarterConfigurationError – If the value is not a positive integer.

The threads in each web server process that run streamed chat prompts.

Constraints:
  • ge = 1

Validated by:
validator parse_app_llmtool_plugin_max_data_results  »  app_llmtool_plugin_max_data_results[source]

Validates the ‘plugin_max_data_results’ field.

Parameters:

v (int | str | None) – the plugin_max_data_results value to validate

Returns:

The validated plugin_max_data_results.

Return type:

int

validator parse_app_mcpserver_rate_limit  »  app_mcpserver_rate_limit[source]

Validates the ‘mcpserver_rate_limit’ field.

Parameters:

v (int | str | None) – the mcpserver_rate_limit value to validate

Returns:

The validated mcpserver_rate_limit.

Return type:

int

validator parse_max_tool_rounds  »  max_tool_rounds[source]

Validates the ‘max_tool_rounds’ field.

Parameters:

v (int | str | None) – the max_tool_rounds value to validate

Returns:

The validated max_tool_rounds.

Return type:

int

validator parse_prompt_history_max_age  »  prompt_history_max_age[source]

Validates the ‘prompt_history_max_age’ field.

Parameters:

v (int | str | None) – the prompt_history_max_age value to validate

Returns:

The validated prompt_history_max_age.

Return type:

int

validator parse_prompt_threads  »  prompt_threads[source]

Validates the ‘prompt_threads’ field.

Parameters:

v (int | str | None) – the prompt_threads value to validate

Returns:

The validated prompt_threads.

Return type:

int

validator validate_app_llmtool_extension_registry_url  »  app_llmtool_extension_registry_url[source]

Validates the ‘extension_registry_url’ field: an https url, or the default if empty.

Parameters:

v (str | None) – the url.

Returns:

The validated url.

Return type:

str

validator validate_llm_default_model  »  llm_default_model[source]

Validates the llm_default_model field: the default if it is empty.

Parameters:

v (str | None) – The model’s name.

Returns:

The validated model’s name.

Return type:

str

validator validate_llm_default_provider  »  llm_default_provider[source]

Validates the llm_default_provider field.

Parameters:

v (str | None) – The LLM default provider value to validate.

Returns:

The validated LLM default provider.

Return type:

str | None

validator validate_llm_default_system_role  »  llm_default_system_role[source]

Validates the llm_default_system_role field.

Parameters:

v (str | None) – The LLM default system role value to validate.

Returns:

The validated LLM default system role.

Return type:

str | None

validator validate_openai_default_max_completion_tokens  »  llm_default_max_tokens[source]

Validates the llm_default_max_tokens field.

Parameters:

v (int | str | None) – The LLM default max tokens value to validate.

Returns:

The validated LLM default max tokens.

Return type:

int

validator validate_openai_default_temperature  »  llm_default_temperature[source]

Validates the llm_default_temperature field.

Parameters:

v (float | None) – The LLM default temperature value to validate.

Returns:

The validated LLM default temperature.

Return type:

float

pydantic model smarter.common.conf.settings.project.ProjectSettings[source]

Facts about the running software: versions, urls of the Smarter project, and paths.

Show JSON schema
{
   "title": "ProjectSettings",
   "description": "Facts about the running software: versions, urls of the Smarter project, and paths.",
   "type": "object",
   "properties": {}
}

pydantic model smarter.common.conf.settings.security.SecuritySettings[source]

The superuser, encryption keys, trusted hosts and request throttling.

Show JSON schema
{
   "title": "SecuritySettings",
   "description": "The superuser, encryption keys, trusted hosts and request throttling.",
   "type": "object",
   "properties": {
      "platform_admin_username": {
         "default": "admin",
         "description": "The username of the platform's superuser, which manage.py initialize_platform creates.",
         "examples": [
            "admin"
         ],
         "title": "Administrator Username",
         "type": "string"
      },
      "platform_admin_password": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The password of the platform's superuser, which manage.py initialize_platform creates.",
         "examples": [
            "your-admin-password"
         ],
         "title": "Administrator Password"
      },
      "platform_fernet_encryption_key": {
         "description": "The Fernet encryption key used for encrypting Smarter Secrets data.",
         "examples": [
            "gAAAAABh..."
         ],
         "format": "password",
         "title": "Fernet Encryption Key",
         "type": "string",
         "writeOnly": true
      },
      "platform_internal_ip_prefixes": {
         "default": [
            "192.168."
         ],
         "description": "A list of internal IP prefixes used for security and middleware features.",
         "examples": [
            [
               "192.168.",
               "10.0."
            ]
         ],
         "items": {
            "type": "string"
         },
         "title": "Internal IP Prefixes",
         "type": "array"
      },
      "DJANGO_SECRET_KEY": {
         "anyOf": [
            {
               "format": "password",
               "type": "string",
               "writeOnly": true
            },
            {
               "type": "null"
            }
         ],
         "description": "The Django secret key for cryptographic signing.",
         "examples": [
            "your-django-secret-key"
         ],
         "title": "Django Secret Key"
      },
      "app_api_throttle_rate_anon": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "120/minute",
         "description": "The request rate limit of each anonymous client, by IP address. None disables it.",
         "examples": [
            "120/minute",
            "10/second",
            "none"
         ],
         "title": "Anonymous Throttle Rate"
      },
      "app_api_throttle_rate_user": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "600/minute",
         "description": "The request rate limit of each authenticated user. None disables it.",
         "examples": [
            "600/minute",
            "20/second",
            "none"
         ],
         "title": "User Throttle Rate"
      }
   }
}

Fields:
Validators:
field app_api_throttle_rate_anon: str | None = '120/minute'

The request rate limit of each anonymous client, by IP address.

Applies to Django REST Framework views and to the apis that a deployed LLMClient serves, e.g. the prompt api of a page that embeds Smarter Chat. A client that exceeds it receives HTTP 429 Too Many Requests with a Retry-After header. See smarter.lib.drf.throttling.

Type:

Optional[str]

Default:

"120/minute"

Raises:

SmarterConfigurationError – If the value is not a rate, e.g. 120/minute, or none.

The request rate limit of each anonymous client, by IP address. None disables it.

Validated by:
field app_api_throttle_rate_user: str | None = '600/minute'

The request rate limit of each authenticated user.

Applies to Django REST Framework views and to the apis that a deployed LLMClient serves. A user who exceeds it receives HTTP 429 Too Many Requests with a Retry-After header. See smarter.lib.drf.throttling.

Type:

Optional[str]

Default:

"600/minute"

Raises:

SmarterConfigurationError – If the value is not a rate, e.g. 600/minute, or none.

The request rate limit of each authenticated user. None disables it.

Validated by:
field django_secret_key: HeldBy(pods=frozenset({'worker', 'worker-infrastructure', 'api', 'job-init'}))] [Optional]

The Django secret key for cryptographic signing.

This setting provides the secret key used by Django for cryptographic signing. It is essential for maintaining the security of sessions, cookies, and other cryptographic operations within the Django framework.

Type:

Optional[str]

Default:

a key that the process generates, with a warning: see generated_django_secret_key()

Raises:

SmarterConfigurationError – If the value is not a string.

The Django secret key for cryptographic signing.

Constraints:
  • pods = frozenset({‘worker’, ‘worker-infrastructure’, ‘api’, ‘job-init’})

Validated by:
field platform_admin_password: HeldBy(pods=frozenset({'job-init'}))] = None

The password of the platform’s superuser.

manage.py initialize_platform gives the superuser and the example users this password, unless --password gives another. Set it with SMARTER_PLATFORM_ADMIN_PASSWORD. Reading it from the environment keeps it off the command line, and out of the init Job’s log.

Type:

Optional[SecretStr]

Default:

None if it is not set.

Raises:

SmarterConfigurationError – If the value is not a SecretStr.

The password of the platform’s superuser, which manage.py initialize_platform creates.

Constraints:
  • pods = frozenset({‘job-init’})

Validated by:
field platform_admin_username: str = 'admin'

The username of the platform’s superuser.

manage.py initialize_platform creates this superuser, unless --username names another. Set it with SMARTER_PLATFORM_ADMIN_USERNAME.

Type:

str

Default:

admin if it is not set.

Raises:

SmarterConfigurationError – If the value is not a non-empty string.

The username of the platform’s superuser, which manage.py initialize_platform creates.

Validated by:
field platform_fernet_encryption_key: HeldBy(pods=frozenset({'worker', 'worker-infrastructure', 'api', 'job-init'}))] [Optional]

The Fernet encryption key used for encrypting Smarter Secrets data.

This setting provides the key used for symmetric encryption and decryption of sensitive data within the platform. The key should be a URL-safe base64-encoded 32-byte key.

Type:

str

Default:

a key that the process generates, with a warning: see generated_fernet_encryption_key()

Raises:

SmarterConfigurationError – If the value is not a valid Fernet key.

The Fernet encryption key used for encrypting Smarter Secrets data.

Constraints:
  • pods = frozenset({‘worker’, ‘worker-infrastructure’, ‘api’, ‘job-init’})

Validated by:
field platform_internal_ip_prefixes: List[str] = ['192.168.']

Supplemental list of internal IP prefixes used in smarter.apps.llmclient.middleware.security.SmarterSecurityMiddleware.

and smarter.lib.django.middleware security features.

The default value is based on the default internal IP range used by Kubernetes clusters by default unless otherwise configured.

A list of internal IP prefixes used for security and middleware features. This setting defines IP address prefixes that are considered internal to the platform. It is used to identify requests originating from trusted internal sources, enabling specific security measures and middleware behaviors.

Type:

List[str]

Default:

["192.168."]

Raises:

SmarterConfigurationError – If the value is not a list of strings

A list of internal IP prefixes used for security and middleware features.

Validated by:
validator validate_app_api_throttle_rate_anon  »  app_api_throttle_rate_anon[source]

Validates the throttle_rate_anon field.

Parameters:

v (str | None) – The rate, e.g. 120/minute, or none to disable the throttle.

Returns:

The validated rate, or None if the throttle is disabled.

Return type:

str | None

validator validate_app_api_throttle_rate_user  »  app_api_throttle_rate_user[source]

Validates the throttle_rate_user field.

Parameters:

v (str | None) – The rate, e.g. 600/minute, or none to disable the throttle.

Returns:

The validated rate, or None if the throttle is disabled.

Return type:

str | None

validator validate_platform_admin_password  »  platform_admin_password[source]

Validates the admin_password field.

Parameters:

v (SecretStr | None) – The administrator password to validate.

Returns:

The validated administrator password, or None if it is missing or a placeholder.

Return type:

SecretStr | None

validator validate_platform_admin_username  »  platform_admin_username[source]

Validates the admin_username field.

Parameters:

v (str | None) – The administrator username to validate.

Returns:

The validated administrator username.

Return type:

str

validator validate_platform_fernet_encryption_key  »  platform_fernet_encryption_key[source]

Validates the fernet_encryption_key field.

Parameters:

v (SecretStr | None) – The Fernet encryption key value to validate.

Raises:
  • ValueError – If the Fernet encryption key is invalid.

  • SmarterValueError – If the Fernet encryption key is not found.

Returns:

The validated Fernet encryption key.

Return type:

SecretStr | None

validator validate_platform_internal_ip_prefixes  »  platform_internal_ip_prefixes[source]

Validates the internal_ip_prefixes field.

Parameters:

v (List[str] | None) – The internal IP prefixes value to validate.

Returns:

The validated internal IP prefixes.

Return type:

List[str]

validator validate_secret_key  »  django_secret_key[source]

Validates the django_secret_key field.

Parameters:

v (SecretStr | None) – The secret key value to validate.

Returns:

The validated secret key.

Return type:

SecretStr

pydantic model smarter.common.conf.settings.tasks.TaskSettings[source]

The Celery queues, retries and LLMClient deployment tasks.

Show JSON schema
{
   "title": "TaskSettings",
   "description": "The Celery queues, retries and LLMClient deployment tasks.",
   "type": "object",
   "properties": {
      "app_llmclient_tasks_create_dns_record": {
         "default": true,
         "description": "True if DNS records should be created for llmclient tasks.",
         "title": "LLMClient Tasks Create DNS Record",
         "type": "boolean"
      },
      "app_llmclient_tasks_create_ingress_manifest": {
         "default": true,
         "description": "True if ingress manifests should be created for llmclient tasks.",
         "title": "LLMClient Tasks Create Ingress Manifest",
         "type": "boolean"
      },
      "app_llmclient_tasks_default_ttl": {
         "default": 600,
         "description": "Default TTL (time to live) for DNS records created in AWS Route53 during LLMClient deployment.",
         "minimum": 0,
         "title": "LLMClient Tasks Default TTL",
         "type": "integer"
      },
      "app_llmclient_tasks_celery_max_retries": {
         "default": 3,
         "description": "Maximum number of retries for llmclient tasks in Celery.",
         "exclusiveMinimum": 0,
         "title": "LLMClient Tasks Celery Max Retries",
         "type": "integer"
      },
      "app_llmclient_tasks_celery_retry_backoff": {
         "default": true,
         "description": "If True, enables exponential backoff for Celery task retries related to LLMClient deployment and management",
         "title": "LLMClient Tasks Celery Retry Backoff",
         "type": "boolean"
      },
      "app_llmclient_tasks_celery_task_queue": {
         "default": "default_celery_task_queue",
         "description": "The Celery task queue name for llmclient tasks.",
         "title": "LLMClient Tasks Celery Task Queue",
         "type": "string"
      },
      "app_infrastructure_tasks_celery_task_queue": {
         "default": "infrastructure_celery_task_queue",
         "description": "The Celery task queue name for infrastructure tasks, which deploy, verify and destroy cloud, Kubernetes and DNS resources.",
         "title": "Infrastructure Tasks Celery Task Queue",
         "type": "string"
      },
      "app_tools_tasks_celery_task_queue": {
         "default": "tools_celery_task_queue",
         "description": "The Celery task queue name for LLM tool calls, which the tool worker, smarter-worker-tools, runs.",
         "title": "Tools Tasks Celery Task Queue",
         "type": "string"
      },
      "app_extensions_tasks_celery_task_queue": {
         "default": "extensions_celery_task_queue",
         "description": "The Celery task queue name for Extensions' tool calls, which smarter-worker-extensions runs.",
         "title": "Extensions Tasks Celery Task Queue",
         "type": "string"
      },
      "app_tools_worker_queue": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The queue that this tool worker consumes: the tools or the Extensions queue. Empty in every other process.",
         "title": "Tool Worker Queue"
      },
      "app_llmtool_tool_runner": {
         "default": "in_process",
         "description": "Where LLM tool calls run: in_process, in the app's own process, or remote, in the tool worker, smarter-worker-tools, which holds no credentials.",
         "enum": [
            "in_process",
            "remote"
         ],
         "title": "LLM Tool Runner",
         "type": "string"
      }
   }
}

Fields:
Validators:
field app_extensions_tasks_celery_task_queue: str = 'extensions_celery_task_queue'

The Celery task queue name for Extensions’ tool calls, when app_llmtool_tool_runner is remote.

The Extension worker, smarter-worker-extensions, serves it, apart from the tool worker, which runs every other kind of tool call (issue #1077). An Extension is third-party code: in a worker of its own, each call in a process of its own, and with a Redis user that reaches only this queue, it can’t see the API, SQL and MCP calls’ credentials, neither in its process nor waiting in Redis. Its name doesn’t start with app_tools_tasks_celery_task_queue’s, so that the tool worker’s Redis user, whose keys are that queue’s prefix, can’t read it either.

Type:

str

Default:

"extensions_celery_task_queue"

Raises:

SmarterConfigurationError – If the value is not a string.

The Celery task queue name for Extensions’ tool calls, which smarter-worker-extensions runs.

Validated by:
field app_infrastructure_tasks_celery_task_queue: str = 'infrastructure_celery_task_queue'

The Celery task queue name for infrastructure tasks.

Infrastructure tasks deploy, verify and destroy cloud, Kubernetes and DNS resources, such as an LLMClient’s DNS record, ingress and certificate, an LLMHost’s node group, or a vectorstore’s database. They can take many minutes, so they run in their own queue, served by their own Celery worker, and never block the operational tasks of llmclient_tasks_celery_task_queue, such as prompt history, charges and budgets.

Type:

str

Default:

"infrastructure_celery_task_queue"

Raises:

SmarterConfigurationError – If the value is not a string.

The Celery task queue name for infrastructure tasks, which deploy, verify and destroy cloud, Kubernetes and DNS resources.

Validated by:
field app_llmclient_tasks_celery_max_retries: int = 3

Maximum number of retries for llmclient tasks in Celery.

Type:

int

Default:

3

Raises:

SmarterConfigurationError – If the value is not a non-negative integer.

Maximum number of retries for llmclient tasks in Celery.

Constraints:
  • gt = 0

Validated by:
field app_llmclient_tasks_celery_retry_backoff: bool = True

If True, enables exponential backoff for Celery task retries related to LLMClient deployment and management.

Type:

bool

Default:

True

Raises:

SmarterConfigurationError – If the value is not a boolean.

If True, enables exponential backoff for Celery task retries related to LLMClient deployment and management

Validated by:
field app_llmclient_tasks_celery_task_queue: str = 'default_celery_task_queue'

The Celery task queue name for llmclient tasks.

Type:

str

Default:

"default_celery_task_queue"

Raises:

SmarterConfigurationError – If the value is not a string.

The Celery task queue name for llmclient tasks.

Validated by:
field app_llmclient_tasks_create_dns_record: bool = True

Set these to true if we DO NOT place a wildcard A record in the customer API domain.

requiring that every llmclient have its own A record. This is the default behavior. For programmatically creating DNS records in AWS Route53 during LLMClient deployment.

Type:

bool

Default:

True

Raises:

SmarterConfigurationError – If the value is not a boolean.

True if DNS records should be created for llmclient tasks.

Validated by:
field app_llmclient_tasks_create_ingress_manifest: bool = True

True if ingress manifests should be created for llmclient tasks.

For programmatically creating ingress manifests during LLMClient deployment. :type: bool :default: True :raises SmarterConfigurationError: If the value is not a boolean.

True if ingress manifests should be created for llmclient tasks.

Validated by:
field app_llmclient_tasks_default_ttl: int = 600

Default TTL (time to live) for DNS records created in AWS Route53 during LLMClient deployment.

Type:

int

Default:

600

Raises:

SmarterConfigurationError – If the value is not a non-negative integer.

Default TTL (time to live) for DNS records created in AWS Route53 during LLMClient deployment.

Constraints:
  • ge = 0

Validated by:
field app_llmtool_tool_runner: Literal['in_process', 'remote'] = 'in_process'

Where LLM tool calls run.

  • in_process, the default: in the process that handles the chat, as they always have.

  • remote: in the tool worker, smarter-worker-tools, through the Celery queue app_tools_tasks_celery_task_queue. The worker holds no database, no Smarter Secret and no cloud credential: each call brings what it needs (ADR-038). The worker must be running.

Set it with SMARTER_APP_LLMTOOL_TOOL_RUNNER. See smarter.apps.llmtool.runner.

Type:

str

Default:

"in_process"

Where LLM tool calls run: in_process, in the app’s own process, or remote, in the tool worker, smarter-worker-tools, which holds no credentials.

field app_tools_tasks_celery_task_queue: str = 'tools_celery_task_queue'

The Celery task queue name for LLM tool calls, when app_llmtool_tool_runner is remote.

The tool worker, smarter-worker-tools, serves it: it runs each tool call without the database or the platform’s credentials (ADR-038). See smarter.apps.llmtool.runner.

Type:

str

Default:

"tools_celery_task_queue"

Raises:

SmarterConfigurationError – If the value is not a string.

The Celery task queue name for LLM tool calls, which the tool worker, smarter-worker-tools, runs.

Validated by:
field app_tools_worker_queue: str | None = None

The queue that this tool worker consumes, set in the tool worker and in the Extension worker only.

Both are workers without a database (database_unavailable), and they differ only by their queue. Each keeps kombu’s in-flight messages under its queue’s name (CELERY_BROKER_TRANSPORT_OPTIONS), checks that its Redis user reaches that queue and no other, runs only that queue’s kind of tool call, and names it in the line that ends its startup checks. Empty, a worker without a database is the tool worker. See tool_worker_queue.

Set it with SMARTER_APP_TOOLS_WORKER_QUEUE.

Type:

Optional[str]

Default:

None

The queue that this tool worker consumes: the tools or the Extensions queue. Empty in every other process.

Validated by:
validator parse_app_llmclient_tasks_celery_max_retries  »  app_llmclient_tasks_celery_max_retries[source]

Validates the ‘llmclient_tasks_celery_max_retries’ field.

Parameters:

v (int | str | None) – the llmclient_tasks_celery_max_retries value to validate

Returns:

The validated llmclient_tasks_celery_max_retries.

Return type:

int

validator parse_app_llmclient_tasks_celery_retry_backoff  »  app_llmclient_tasks_celery_retry_backoff[source]

Validates the ‘llmclient_tasks_celery_retry_backoff’ field.

Parameters:

v (bool | str | None) – the llmclient_tasks_celery_retry_backoff value to validate

Returns:

The validated llmclient_tasks_celery_retry_backoff.

Return type:

bool

validator parse_app_llmclient_tasks_create_dns_record  »  app_llmclient_tasks_create_dns_record[source]

Validates the ‘llmclient_tasks_create_dns_record’ field.

Parameters:

v (bool | str | None) – the llmclient_tasks_create_dns_record value to validate

Returns:

The validated llmclient_tasks_create_dns_record.

Return type:

bool

validator parse_app_llmclient_tasks_create_ingress_manifest  »  app_llmclient_tasks_create_ingress_manifest[source]

Validates the ‘llmclient_tasks_create_ingress_manifest’ field.

Parameters:

v (bool | str | None) – the llmclient_tasks_create_ingress_manifest value to validate

Returns:

The validated llmclient_tasks_create_ingress_manifest.

Return type:

bool

validator parse_app_llmclient_tasks_default_ttl  »  app_llmclient_tasks_default_ttl[source]

Validates the ‘llmclient_tasks_default_ttl’ field.

Parameters:

v (int | str | None) – the llmclient_tasks_default_ttl value to validate

Returns:

The validated llmclient_tasks_default_ttl.

Return type:

int

validator validate_app_extensions_tasks_celery_task_queue  »  app_extensions_tasks_celery_task_queue[source]

Validate app_extensions_tasks_celery_task_queue.

Parameters:

v (str | None) – The queue’s name, or empty for the default.

Return type:

str

Returns:

The queue’s name.

Raises:

SmarterConfigurationError – If the value is not a string.

validator validate_app_infrastructure_tasks_celery_task_queue  »  app_infrastructure_tasks_celery_task_queue[source]

Validates the infrastructure_tasks_celery_task_queue field.

Parameters:

v (str | None) – The llmclient tasks celery task queue value to validate.

Returns:

The validated llmclient tasks celery task queue.

Return type:

str

validator validate_app_llmclient_tasks_celery_task_queue  »  app_llmclient_tasks_celery_task_queue[source]

Validates the llmclient_tasks_celery_task_queue field.

Parameters:

v (str | None) – The llmclient tasks celery task queue value to validate.

Returns:

The validated llmclient tasks celery task queue.

Return type:

str

validator validate_app_tools_tasks_celery_task_queue  »  app_tools_tasks_celery_task_queue[source]

Validate app_tools_tasks_celery_task_queue.

Parameters:

v (str | None) – The queue’s name, or empty for the default.

Return type:

str

Returns:

The queue’s name.

Raises:

SmarterConfigurationError – If the value is not a string.

validator validate_app_tools_worker_queue  »  app_tools_worker_queue[source]

Validate app_tools_worker_queue.

Parameters:

v (str | None) – The queue’s name, or empty.

Return type:

str | None

Returns:

The queue’s name, or None.

Raises:

SmarterConfigurationError – If the value is not a string.

Helpers

Utility functions for settings.

The field validators of the Settings use these, so that the same rule is written once.

smarter.common.conf.util.THROTTLE_RATE_DISABLED = ('none', 'off', 'disabled')

The values that disable a throttle.

('none', 'off', 'disabled')
smarter.common.conf.util.THROTTLE_RATE_PATTERN: Pattern = re.compile('^\\d+/(s|sec|second|m|min|minute|h|hour|d|day)$')

requests per second, minute, hour or day.

Type:

A Django REST Framework throttle rate

smarter.common.conf.util.before_field_validator(*args, **kwargs)[source]

Wrapper for pydantic field_validator with mode=’before’.

smarter.common.conf.util.comma_separated(v)[source]

Split a comma-separated string into a list, e.g. "a, b," into ["a", "b"].

A list setting’s environment variable is a comma-separated string. Any other value is returned as it is, for its validator to judge.

Parameters:

v (Any) – The value of a list setting.

Return type:

Any

Returns:

The list of the string’s items, without whitespace or empty items, or the value itself, which may be of any type: the validator that calls it judges it.

smarter.common.conf.util.field_default(model, field_name)[source]

Return a settings field’s default, as its declaration states it.

The validators use it for a value that is empty, e.g. "" passed to the constructor, so that a default is written once, on its field.

Parameters:
  • model (type[BaseModel] | BaseModel) – The settings class, or the class of one group of its fields. An instance of one is read as its class: the validators’ cls is typed as an instance.

  • field_name (str) – The field, e.g. debug_mode.

Return type:

Any

Returns:

Its default, whose type is the field’s. A default that a factory makes is made.

smarter.common.conf.util.input_value(model, data, field_name)[source]

Return the value that a field will be validated from: the one given, or else its default.

Parameters:
  • model (type[BaseModel] | BaseModel) – The settings class, or the class of one group of its fields.

  • data (object) – The values that a mode="before" model validator receives.

  • field_name (str) – The field.

Return type:

Any

Returns:

Its value, not yet validated, which may be of any type the field accepts.

smarter.common.conf.util.is_unset(data, field_name)[source]

Return True if the values to validate leave a field out, or set it to an empty value.

Parameters:
  • data (object) – The values that a mode="before" model validator receives.

  • field_name (str) – The field.

Return type:

bool

Returns:

True if the field will get its default.

smarter.common.conf.util.parse_int_setting(field_name, v, default, minimum=None, maximum=None)[source]

Parse an integer setting, e.g. "300" from an environment variable.

An empty value, or the placeholder of a missing one, is replaced by default, which is parsed and checked like any other value.

Parameters:
  • field_name (str) – The name of the field, for the error message.

  • v (object) – The value to parse: an int, or a string of one.

  • default (object) – The value to use if v is empty.

  • minimum (int | None) – The smallest value allowed, or None for no lower bound.

  • maximum (int | None) – The largest value allowed, or None for no upper bound.

Return type:

int

Returns:

The value, as an int.

Raises:

SmarterConfigurationError – If the value isn’t an integer, or is out of bounds.

smarter.common.conf.util.validate_throttle_rate(field_name, v, default)[source]

Validate a Django REST Framework throttle rate.

Parameters:
  • field_name (str) – The name of the field, for the error message.

  • v (str | None) – The rate, e.g. 120/minute, or one of THROTTLE_RATE_DISABLED.

  • default (str | None) – The rate to use if the value is empty.

Return type:

str | None

Returns:

The rate, or None if the throttle is disabled.

Raises:

SmarterConfigurationError – If the value is not a rate.

smarter.common.conf.util.with_derived_default(data, field_name, value)[source]

Return the values to validate, with a derived default for a field that they leave unset.

A default that depends on another field, e.g. an address at the platform’s domain, can’t be written on its field. A mode="before" model validator computes it instead, and passes it here.

Parameters:
  • data (object) – The values that a mode="before" model validator receives.

  • field_name (str) – The field.

  • value (object) – Its derived default.

Return type:

object

Returns:

A copy of the values with the field set, or the values themselves if they set it.

Which settings are credentials, and which kinds of pod may hold each one (ADR-038, phase 3).

Every pod used to read one Secret with every credential, though most use few of them. Each credential now says which kinds of pod (SERVICE_TYPE, smarter.common.const.SmarterKubernetesPodKinds.all) use it, with HeldBy in its annotation:

github_token: Annotated[Optional[SecretStr], HeldBy(SmarterKubernetesPodKinds.API, SmarterKubernetesPodKinds.WORKER)] = Field(...)
  • Every setting whose type is SecretStr is a credential, and must say who holds it, even nobody (HeldBy()): a test fails otherwise. Deriving the credentials from the type, rather than marking each one, means that a new SecretStr setting can’t be left out.

  • The Helm chart gives each pod only its own credentials, from helm/charts/smarter/files/credentials.json, which credential_holders_by_variable() writes (make chart-credentials).

  • When a pod starts, smarter.common.conf.settings.Settings.check_pod_credentials() reports each credential it was given but doesn’t use (forbidden_credentials()). The tool worker and the Extension worker, which run code that the platform doesn’t control (ADR-038, issue #1077), refuse to start instead (check_restricted_worker_credentials()): they hold no credential but their own Redis user’s password.

  • The converse holds too (ADR-007, “Sensitive values”): a setting whose name or value says it is a credential is a SecretStr, which misdeclared_credentials() checks, so that a credential added as str can’t be printed in full by the settings dump.

smarter.common.conf.credentials.CHART_CREDENTIALS_PATH = '/Users/mcdaniel/Desktop/gh/smarter-sh/smarter/smarter/smarter/common/conf/credentials.json'

The committed map of each credential’s environment variables to the kinds of pod that hold it.

manage.py export_chart_credentials writes it, and make chart-credentials copies it to the Helm chart, as helm/charts/smarter/files/credentials.json, which the chart reads to build each pod’s Secret. A test fails when it doesn’t match the settings, and the chart’s tests when the chart’s copy doesn’t match it.

smarter.common.conf.credentials.CREDENTIAL_NAME_WORDS = frozenset({'credential', 'credentials', 'dsn', 'passwd', 'password', 'secret', 'token'})

The words of a setting’s name, split at underscores, that say it is a credential, e.g. subsystem_smtp_password.

smarter.common.conf.credentials.ENVIRONMENT_PREFIX = 'SMARTER_'

The prefix of a setting’s environment variable, as Settings.model_config’s env_prefix.

class smarter.common.conf.credentials.HeldBy(*pods)[source]

Marks a credential with the kinds of pod that may hold it.

Parameters:

pods (str) – The kinds of pod, from smarter.common.const.SmarterKubernetesPodKinds.all. None: no pod uses the credential, e.g. a setting that nothing reads yet.

__init__(*pods)[source]
smarter.common.conf.credentials.NOT_CREDENTIALS: dict[str, str] = {'app_llmtool_extension_registry_public_key': "the Ed25519 public key that verifies the registry's index: public"}

The settings whose name says credential but which aren’t, each with the reason.

Keep it short.

{
    'app_llmtool_extension_registry_public_key': "the Ed25519 public key that verifies the registry's index: public",
}
smarter.common.conf.credentials.credential_holders(field)[source]

Return the kinds of pod that may hold a credential, from the HeldBy in its annotation.

Parameters:

field (FieldInfo) – The setting’s field.

Return type:

frozenset[str] | None

Returns:

The kinds of pod, or None if the credential doesn’t say.

smarter.common.conf.credentials.credential_holders_by_variable(settings_class)[source]

Map each credential’s environment variables to the kinds of pod that may hold it: what the Helm chart reads.

make chart-credentials writes it to helm/charts/smarter/files/credentials.json, and a test fails when that file is out of date. The chart gives each pod’s Secret only the variables that name its kind.

Parameters:

settings_class (type[BaseModel]) – The settings’ class, smarter.common.conf.settings.Settings.

Return type:

dict[str, list[str]]

Returns:

Each variable, sorted, and its pod kinds, sorted. A credential that no pod holds maps to an empty list.

smarter.common.conf.credentials.embeds_password(value)[source]

Return whether a setting’s value is a url with a password in it, e.g. redis://user:password@host:6379.

Parameters:

value (object) – The setting’s value, of any type.

Return type:

bool

Returns:

True if the value is a url whose user info has a password.

smarter.common.conf.credentials.environment_variables(name, field)[source]

Return the environment variables that a setting is read from: its validation_alias, or SMARTER_<NAME>.

Parameters:
  • name (str) – The setting’s name, e.g. subsystem_smtp_password.

  • field (FieldInfo) – The setting’s field.

Return type:

list[str]

Returns:

The variables’ names, e.g. ["SMARTER_SUBSYSTEM_SMTP_PASSWORD"].

smarter.common.conf.credentials.forbidden_credentials(settings, environ, pod_kind='worker-tools')[source]

Return the names of the credentials that a kind of pod was given, but doesn’t use.

A credential counts only if the process’s environment sets one of its variables to a value. A value that the settings derive themselves, e.g. a generated Fernet key or the local environment’s default database password, is not one that the worker was given, and doesn’t count. Names only: never a value.

Parameters:
  • settings (BaseModel) – The settings.

  • environ (Mapping[str, str]) – The process’s environment, e.g. os.environ.

  • pod_kind (str) – The kind of pod, e.g. worker. The tool worker’s by default.

Return type:

list[str]

Returns:

The settings’ names, sorted, or an empty list.

smarter.common.conf.credentials.holds_text(field)[source]

Return whether a setting’s value can be plain text: its type is str, or a union with str.

A credential is text, so a bool or an int named like one, e.g. app_secret_enable, the switch of the Secret resource’s app, isn’t one.

Parameters:

field (FieldInfo) – The setting’s field.

Return type:

bool

Returns:

True if the value can be a str.

smarter.common.conf.credentials.is_credential(field)[source]

Return whether a setting is a credential: its type is SecretStr, or Optional[SecretStr].

Parameters:

field (FieldInfo) – The setting’s field.

Return type:

bool

Returns:

True for a credential.

smarter.common.conf.credentials.is_given(environ, variables)[source]

Return whether the environment sets one of a credential’s variables to a value, not empty and not a placeholder.

Parameters:
  • environ (Mapping[str, str]) – The process’s environment.

  • variables (list[str]) – The credential’s variables.

Return type:

bool

Returns:

True if one has a value.

smarter.common.conf.credentials.is_named_like_a_credential(name)[source]

Return whether a setting’s name says it is a credential (ADR-007, “Sensitive values”).

A name says so when one of its words is in CREDENTIAL_NAME_WORDS, or when it ends with _key, e.g. django_secret_key, account_manager_api_key or aws_secret_access_key. Whole words only, so that llm_default_max_tokens and bootstrap_secrets_dir don’t count.

Parameters:

name (str) – The setting’s name.

Return type:

bool

Returns:

True if the name says credential.

smarter.common.conf.credentials.may_hold(field, pod_kind)[source]

Return whether a kind of pod may hold a credential.

A credential that doesn’t say may be held by none.

Parameters:
  • field (FieldInfo) – The setting’s field.

  • pod_kind (str) – The kind of pod, e.g. worker.

Return type:

bool

Returns:

True if it may.

smarter.common.conf.credentials.misdeclared_credentials(settings_class, settings=None)[source]

Return the settings that should be a SecretStr but aren’t (ADR-007, “Sensitive values”).

A SecretStr is masked in repr(), in the settings dump and in a validation error, so a credential declared as str would be logged in full. A setting should be one when:

Parameters:
  • settings_class (type[BaseModel]) – The settings’ class, e.g. smarter.common.conf.Settings.

  • settings (BaseModel | None) – An instance whose values are checked for urls with passwords too, or None for the defaults only.

Return type:

list[str]

Returns:

The names of the settings, sorted.

smarter.common.conf.credentials.render_chart_credentials(settings_class)[source]

Return the text of CHART_CREDENTIALS_PATH: credential_holders_by_variable(), as JSON.

Parameters:

settings_class (type[BaseModel]) – The settings’ class, smarter.common.conf.settings.Settings.

Return type:

str

Returns:

The JSON, indented, with a trailing newline, so that a change is a readable diff.

smarter.common.conf.credentials.restricted_workers_may_hold(field)[source]

Return whether the tool worker and the Extension worker may hold a credential: their own Redis user’s password.

Parameters:

field (FieldInfo) – The setting’s field.

Return type:

bool

Returns:

True if both may.

smarter.common.conf.credentials.write_chart_credentials(settings_class, path='/Users/mcdaniel/Desktop/gh/smarter-sh/smarter/smarter/smarter/common/conf/credentials.json')[source]

Write render_chart_credentials() to a file.

Parameters:
Return type:

str

Returns:

The file’s path.

The environment

This module contains constants used for Pydantic Settings.

smarter.common.conf.const.DEFAULT_MISSING_VALUE = 'SET-ME-PLEASE'

The placeholder of a setting that is not set, e.g. in .env.example.

smarter.common.conf.const.DOT_ENV_LOADED = True

True if .env file was loaded successfully.

smarter.common.conf.const.LOCAL_HOSTS = ['localhost', '127.0.0.1', 'localhost:9357', '127.0.0.1:9357', 'localhost:5173', 'testserver']

the dev server, the React dev server, Django’s test client.

[
    'localhost',
    '127.0.0.1',
    'localhost:9357',
    '127.0.0.1:9357',
    'localhost:5173',
    'testserver',
]
Type:

The hosts of a developer’s own machine, which are always local

smarter.common.conf.const.SENSITIVE_FILES_AMNESTY_PATTERNS = (re.compile('^/$', re.IGNORECASE), re.compile('^/static(/.*)?$', re.IGNORECASE), re.compile('^/api/v\\d+(\\.\\d+)?/.+', re.IGNORECASE), re.compile('^/api/web/.+', re.IGNORECASE), re.compile('^/dashboard(/.*)?$', re.IGNORECASE), re.compile('^/docs/manifest(/.*)?$', re.IGNORECASE), re.compile('^/docs/json-schema(/.*)?$', re.IGNORECASE), re.compile('^/config/?$', re.IGNORECASE), re.compile('^/login/?$', re.IGNORECASE), re.compile('^/admin/?$', re.IGNORECASE))

The paths that the sensitive files middleware never blocks, even when they end like a sensitive file, a.

static set that no setting changes: the home page, static files,.

the apis, the dashboard, the manifest and JSON Schema docs, an LLMClient’s /config/, the sign-in page and the admin.

(
    re.compile('^/$', re.IGNORECASE),
    re.compile('^/static(/.*)?$', re.IGNORECASE),
    re.compile('^/api/v\\d+(\\.\\d+)?/.+', re.IGNORECASE),
    re.compile('^/api/web/.+', re.IGNORECASE),
    re.compile('^/dashboard(/.*)?$', re.IGNORECASE),
    re.compile('^/docs/manifest(/.*)?$', re.IGNORECASE),
    re.compile('^/docs/json-schema(/.*)?$', re.IGNORECASE),
    re.compile('^/config/?$', re.IGNORECASE),
    re.compile('^/login/?$', re.IGNORECASE),
    re.compile('^/admin/?$', re.IGNORECASE),
)
smarter.common.conf.const.SERVICE_TYPE = None

The kind of pod this process runs in, unvalidated, from the SERVICE_TYPE environment variable.

Read the validated value, smarter_settings.service_type, instead: its docstring, and smarter.common.const.SmarterKubernetesPodKinds, list the kinds that the Helm chart and docker-compose set.

Smarter common environment variable utilities.

smarter.common.conf.env.EnvValueType = str | bool | int | float | list[str] | dict[str, typing.Any] | None

The types of value that get_env() returns.

Which one is determined by the type of its default.

smarter.common.conf.env.cast_environment_value(var_name, val, default)[source]

Cast an environment variable’s value to the type of a default value.

A string stays a string, and true, 1, t, y or yes is a True bool. An int or a float is parsed, a list is split on commas, and a dict is parsed as JSON. A value that can’t be cast is logged, without the value, and replaced by the default.

Parameters:
  • var_name (str) – The variable’s name, for the log message.

  • val (str | None) – Its value, or None if it is not set.

  • default (str | bool | int | float | list[str] | dict[str, Any] | None) – The value whose type it is cast to, and that it is replaced by if it is missing.

Return type:

str | bool | int | float | list[str] | dict[str, Any] | None

Returns:

The cast value.

smarter.common.conf.env.get_env(var_name, default='SET-ME-PLEASE', is_secret=False, is_required=False)[source]

Retrieve a configuration value from the environment, with prefix fallback and type conversion.

Overloads:
  • var_name (str), default (bool), is_secret (bool), is_required (bool) → bool

  • var_name (str), default (int), is_secret (bool), is_required (bool) → int

  • var_name (str), default (float), is_secret (bool), is_required (bool) → float

  • var_name (str), default (list[str]), is_secret (bool), is_required (bool) → list[str]

  • var_name (str), default (SmarterDictType), is_secret (bool), is_required (bool) → SmarterDictType

  • var_name (str), default (None), is_secret (bool), is_required (bool) → Optional[str]

  • var_name (str), default (str), is_secret (bool), is_required (bool) → str

This function attempts to obtain a configuration value from the environment using the key <var_name>. If the environment variable is not set, it returns the provided default value. The function also performs type conversion and validation based on the type of the default value, supporting strings, booleans, integers, floats, lists (comma-separated), and dictionaries (JSON-encoded).

Behavior:

  • Checks for the presence of the environment variable <var_name>.

  • If found, attempts to convert the value to the type of default.

  • If not found, or if it holds the SET-ME-PLEASE placeholder, returns the default value.

  • Logs a message if the environment variable is missing or if type conversion fails.

This utility is used throughout the Smarter platform to provide a consistent and robust mechanism for loading configuration values from the environment, with sensible type handling and error reporting.

Parameters:
  • var_name (str) – The base name of the environment variable (without the prefix).

  • default (str | bool | int | float | list[str] | dict[str, Any] | None) – The default value to return if the environment variable is not set. The type of this value determines the expected type and conversion logic.

Returns:

The value from the environment (converted to the appropriate type), or the default if it is not set, holds the SET-ME-PLEASE placeholder, or cannot be converted. Only a default of None returns None.

Return type:

EnvValueType

smarter.common.conf.env.is_missing_value(value)[source]

Return True if a configuration value is missing.

A value is missing if it is None, empty, or a placeholder, such as .env.example’s SET-ME-PLEASE or helm/charts/smarter/values.yaml’s SET-ME-IN-helm/.... A pydantic.SecretStr is unwrapped first.

Parameters:

value (Any) – The value, e.g. from get_env().

Return type:

bool

Returns:

True if the value is missing.

smarter.common.conf.env.read_environment_variable(var_name)[source]

Read an environment variable, with or without Smarter’s SMARTER_ prefix.

The name without the prefix is read first, then the name with it. Surrounding whitespace and quotes are stripped.

Parameters:

var_name (str) – The variable’s name, without the prefix, e.g. DEBUG_MODE.

Return type:

str | None

Returns:

Its value, or None if neither name is set.