PluginSelectorHistory Model
PluginSelectorHistory model for tracking plugin selector activations.
- class smarter.apps.llmtool.models.plugin_selector_history.PluginSelectorHistory(*args, **kwargs)[source]
Bases:
TimestampedModelStores the history of plugin selector activations for auditing and analytics.
The
PluginSelectorHistorymodel records every instance in which a plugin was selected for inclusion in an LLM prompt, capturing the context and rationale for the selection. Each record includes a reference to the associatedPluginSelector, the specific search term (if any) that triggered the selection, the full set of user prompt messages at the time of activation, and the session key for correlating events across a user session.This model is essential for understanding and debugging plugin routing decisions within the Smarter platform. By persisting a detailed log of selector activations, it enables retrospective analysis of plugin usage patterns, supports compliance and auditing requirements, and provides valuable data for improving plugin selection strategies.
PluginSelectorHistoryworks closely with:PluginSelector, which defines the selection logic and strategies for plugins.PluginMeta, which provides the core metadata for each plugin and is referenced indirectly via the selector.PluginPrompt, which may be used to further customize the LLM prompt for the selected plugin.
Typical use cases include tracking which plugins were surfaced to the LLM in response to specific user queries, analyzing the effectiveness of search term-based selection, and debugging unexpected plugin activations.
See also:
PluginSelector
- Parameters:
id (Unknown) – Primary key: ID
created_at (Unknown) – Created at
updated_at (Unknown) – Updated at
search_term (Unknown) – Search term
messages (Unknown) – Messages. The user prompt messages.
session_key (Unknown) – Session key
Relationship fields:
- Parameters:
plugin_selector (Unknown) – Plugin selector (related name:
plugin_selector_history_plugin_selector)
- 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
- id
-
Primary key: ID
- Type:
Type
- objects = <django.db.models.Manager object>
- plugin_selector
-
Plugin selector (related name:
plugin_selector_history_plugin_selector)- Type:
Type
- plugin_selector_id
Internal field, use
plugin_selectorinstead.
- 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
- class smarter.apps.llmtool.models.plugin_selector_history.PluginSelectorHistorySerializer(*args, **kwargs)[source]
Bases:
ModelSerializerSerializer for the PluginSelectorHistory model.
This serializer provides a complete representation of
PluginSelectorHistoryrecords, including all model fields and a nested serialization of the relatedPluginSelector. It is used to expose selector activation history for auditing, analytics, and debugging purposes.By including the nested selector, this serializer enables clients to access both the activation context and the selection logic that led to the plugin being surfaced to the LLM. This is particularly useful for building admin interfaces, audit logs, or analytics dashboards that require insight into plugin routing decisions.
See also:
PluginSelector