iamai.config module

Configuration module.

iamai uses pydantic to read configuration.

class iamai.config.AdapterConfig(**extra_data: Any)[source]

Bases: ConfigModel

Adapter configuration.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}

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

class iamai.config.BotConfig(*, plugins: ~typing.Set[str] = <factory>, plugin_dirs: ~typing.Set[~pathlib.Annotated[~pathlib.Path, ~pydantic.types.PathType(path_type=dir)]] = <factory>, adapters: ~typing.Set[str] = <factory>, locale: ~typing.Set[str] = <factory>, log: ~iamai.config.LogConfig = LogConfig(level='DEBUG', verbose_exception=False), **extra_data: ~typing.Any)[source]

Bases: ConfigModel

Bot configuration.

plugins

List of plugins to be loaded, which will be loaded by the load_plugins() method of the Bot class.

Type:

Set[str]

plugin_dirs

List of plugin directories to be loaded, which will be loaded by the load_plugins_from_dirs() method of the Bot class.

Type:

Set[Annotated[pathlib.Path, pydantic.types.PathType(path_type=dir)]]

adapters

A list of adapters to be loaded, which will be loaded in turn by the load_adapters() method of the Bot class.

Type:

Set[str]

log

iamai log related settings.

Type:

iamai.config.LogConfig

adapters: Set[str]
locale: Set[str]
log: LogConfig
model_config: ClassVar[ConfigDict] = {'extra': 'allow'}

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

plugin_dirs: Set[Annotated[Path, PathType(path_type=dir)]]
plugins: Set[str]
class iamai.config.ConfigModel(**extra_data: Any)[source]

Bases: BaseModel

iamai configuration model.

__config_name__

Configuration name.

Type:

str

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}

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

class iamai.config.LogConfig(*, level: str | int = 'DEBUG', verbose_exception: bool = False, **extra_data: Any)[source]

Bases: ConfigModel

iamai log related settings.

level

log level.

Type:

str | int

verbose_exception

Detailed exception record. When set to True, exception Traceback will be added to the log.

Type:

bool

level: str | int
model_config: ClassVar[ConfigDict] = {'extra': 'allow'}

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

verbose_exception: bool
class iamai.config.MainConfig(*, bot: BotConfig = BotConfig(plugins=set(), plugin_dirs=set(), adapters=set(), locale=set(), log=LogConfig(level='DEBUG', verbose_exception=False)), plugin: PluginConfig = PluginConfig(), adapter: AdapterConfig = AdapterConfig(), **extra_data: Any)[source]

Bases: ConfigModel

iamai configuration.

bot

the main configuration of iamai.

Type:

iamai.config.BotConfig

adapter: AdapterConfig
bot: BotConfig
model_config: ClassVar[ConfigDict] = {'extra': 'allow'}

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

plugin: PluginConfig
class iamai.config.PluginConfig(**extra_data: Any)[source]

Bases: ConfigModel

Plugin configuration.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}

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