LLMClientPlugin Model
- class smarter.apps.llm_client.models.LLMClientPlugin(*args, **kwargs)[source]
Bases:
TimestampedModelRepresents the association between a LLMClient instance and its enabled plugins within the Smarter platform.
This model establishes a many-to-one relationship, where each plugin entry is linked to a specific LLMClient and references metadata describing the plugin. By maintaining this mapping, the platform can manage which plugins are available to each llm_client, enabling extensibility and customization of llm_client capabilities.
The LLMClientPlugin model supports use cases such as plugin activation, deactivation, and enumeration for individual llm_clients. It is essential for scenarios where llm_clients require additional functionality provided by external or internal plugins, such as integrations, enhanced processing, or custom behaviors.
Model Relationships
Each LLMClientPlugin is linked to one
LLMClientinstance.Each LLMClientPlugin references one
PluginMetainstance, which contains metadata about the plugin.
Usage Example
# Add a plugin to an llm_client plugin_meta = PluginMeta.objects.get(name="weather") llm_client_plugin = LLMClientPlugin.objects.create(llm_client=my_llm_client, plugin_meta=plugin_meta) # List all plugins for an llm_client plugins = LLMClientPlugin.objects.filter(llm_client=my_llm_client)
Notes
Plugin management and loading are handled via the PluginController and related infrastructure.
This model is intended for internal use to support dynamic extension of llm_client features.
Uniqueness is enforced for each (llm_client, plugin_meta) pair to prevent duplicate plugin assignments.
- Parameters:
id (Unknown) – Primary key: ID
created_at (Unknown) – Created at
updated_at (Unknown) – Updated at
Relationship fields:
- Parameters:
llm_client (Unknown) –
Llm client (related name:
llmclientplugin)The LLMClient instance associated with this plugin.
plugin_meta (Unknown) –
Plugin meta (related name:
llmclientplugin)The metadata for the plugin associated with the LLMClient.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- exception NotUpdated
Bases:
ObjectNotUpdated,DatabaseError
- created_at
-
Created at
Timestamp indicating when the model instance was created.
This field is automatically set to the current date and time when the instance is first created. It is indexed in the database for efficient querying.
- Type:
Type
- classmethod get_cached_objects(invalidate=False, llm_client=None)[source]
Retrieve a queryset of LLMClientPlugin instances associated with a LLMClient using caching.
- id
-
Primary key: ID
- Type:
Type
- llm_client
-
Llm client (related name:
llmclientplugin)The LLMClient instance associated with this plugin.
- Type:
Type
- llm_client_id
Internal field, use
llm_clientinstead.
- classmethod load(llm_client, data)[source]
Load (aka import) a plugin from a data file in yaml or json format.
- Parameters:
llm_client (
LLMClient) – The LLMClient instance to associate with the plugin.data – The plugin manifest data in yaml or json format.
- Returns:
The created LLMClientPlugin instance.
- Return type:
See Also:
- objects = <django.db.models.Manager object>
- property plugin: PluginBase | None
Returns the Plugin instance associated with this LLMClientPlugin.
- Returns:
Plugin instance or None
- Return type:
Optional[PluginBase]
- plugin_meta
-
Plugin meta (related name:
llmclientplugin)The metadata for the plugin associated with the LLMClient.
- Type:
Type
- plugin_meta_id
Internal field, use
plugin_metainstead.
- classmethod plugins(llm_client)[source]
Returns a list of Plugin instances associated with the given LLMClient.
- Parameters:
llm_client (
LLMClient) – The LLMClient instance to retrieve plugins for.- Returns:
List of Plugin instances.
- Return type:
- Raises:
SmarterValueError – If admin user for llm_client account is not found or if a plugin fails to load.
See Also:
smarter.apps.plugin.controller.PluginController
- updated_at
-
Updated at
Timestamp indicating when the model instance was last updated.
This field is automatically updated to the current date and time whenever the instance is saved. It is indexed in the database for efficient querying.
- Type:
Type