Utils
Plugin utils module for core plugin functionality.
- class smarter.apps.llmtool.plugin.utils.Plugins(user, account)[source]
Bases:
objectA class for managing and interacting with multiple plugins.
This class provides methods to retrieve, serialize, and work with plugins associated with a user and account. It loads plugins using metadata and controllers, and exposes their data in dictionary and JSON formats.
- Parameters:
Note
A plugin that cannot be loaded, for example one whose plugin data is missing, is logged and skipped.
See also
PluginControllerfor plugin instantiation.PluginMetafor plugin metadata.Example usage:
plugins = Plugins(user=my_user, account=my_account) plugin_dicts = plugins.data plugin_json = plugins.to_json()
- static load_plugin(plugin_meta, user_profile)[source]
Load a plugin, or log and skip it if it cannot be loaded.
One malformed plugin, for example one whose plugin data is missing, should not prevent the others from being listed.
- Parameters:
plugin_meta (
PluginMeta) – The plugin’s PluginMeta.user_profile (
UserProfile) – The plugin’s owner.
- Returns:
The plugin, or None if it cannot be loaded.
- Return type:
- plugins: list[PluginBase] = []
- user_profile: UserProfile | None = None