Settings
An extension’s settings: declared in its manifest, configured by an administrator.
resolve_settings() turns an extension’s ExtensionSetting
rows into a typed Pydantic model, with one attribute per declared setting, which reaches
the extension’s code as settings. A secret setting
is a pydantic.SecretStr, read from its Secret
at call time and never cached.
- class smarter.apps.llmtool.extension.settings.ExtensionSettingsBase(**data)[source]
Bases:
BaseModelThe base class of every extension’s settings model.
Settings cannot be changed by the extension.
- model_config = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- smarter.apps.llmtool.extension.settings.missing_required_settings(extension, manifest)[source]
Return the names of the required settings that have neither a value nor a default.
An extension cannot be enabled while any are missing.
- Parameters:
extension (
Extension) – The extension.manifest (
ExtensionManifest) – The manifest of the version that runs.
- Return type:
- smarter.apps.llmtool.extension.settings.resolve_settings(extension, manifest)[source]
Return an extension’s settings, as its code sees them.
- Parameters:
extension (
Extension) – The extension.manifest (
ExtensionManifest) – The manifest of the version that runs.
- Return type:
- Returns:
The settings model, with every declared setting’s value.
- smarter.apps.llmtool.extension.settings.setting_value(spec, row)[source]
Return the value of one setting: the configured value, or the default.
- Parameters:
spec (
ExtensionSettingSpec) – The setting’s declaration.row (
ExtensionSetting|None) – Its configured value, if any.
- Return type:
- Returns:
The value, as the setting’s type, or None if it has neither a value nor a default.
- smarter.apps.llmtool.extension.settings.settings_model(manifest)[source]
Return the Pydantic model of an extension’s settings.
- Parameters:
manifest (
ExtensionManifest) – The extension’s manifest.- Return type:
- Returns:
A model with one optional attribute per declared setting.