DRF Serializers
PluginMeta serializers.
- class smarter.apps.llmtool.serializers.PluginApiSerializer(*args, **kwargs)[source]
Bases:
SmarterCamelCaseSerializerSerializer for the PluginDataApi model.
This serializer exposes API plugin configuration fields, including the connection, HTTP method, endpoint, URL parameters, headers, body, and result limit. It is used to serialize and deserialize API plugin settings for API endpoints.
- Parameters:
connection (str) – The name of the API connection to use.
method (str) – The HTTP method for the API request (e.g., “GET”, “POST”).
endpoint (str) – The API endpoint path.
url_params (dict or list) – URL parameters for the API request.
headers (dict) – HTTP headers for the API request.
limit (int) – The maximum number of results to return.
- Returns:
Serialized API plugin configuration.
- Return type:
Note
The connection field uses a slug related to the connection name and must reference an existing ApiConnection.
See also
PluginDataApiApiConnection
Example usage:
from smarter.apps.llmtool.serializers import PluginApiSerializer from smarter.apps.llmtool.models import PluginDataApi api_plugin = PluginDataApi.objects.first() serializer = PluginApiSerializer(api_plugin) print(serializer.data) # Output: { # "connection": "...", # "method": "...", # "endpoint": "...", # "urlParams": {...}, # "headers": {...}, # "body": {...}, # "limit": ... # }
- queryset = []
- class smarter.apps.llmtool.serializers.PluginImageSearchSerializer(*args, **kwargs)[source]
Bases:
SmarterCamelCaseSerializerSerializer for the PluginDataImageSearch model.
Experimental.
This serializer exposes the configuration of an ImageSearchPlugin: the name of the Secret that contains its Brave Search API key, its Brave Image Search API query parameters, its filters, url validation, timeout and cache duration. The api key itself is never serialized.
Example usage:
serializer = PluginImageSearchSerializer(PluginDataImageSearch.objects.first()) print(serializer.data) # Output: { # "description": "...", # "apiKeySecretName": "brave_search_api_key", # "count": 10, # "safesearch": "strict", # ... # }
Note
Experimental. The ImageSearchPlugin was designed and coded by Claude Code (Anthropic’s Claude Opus 5.5), with Lawrence McDaniel as co-author. It is experimental.
- class smarter.apps.llmtool.serializers.PluginMetaSerializer(*args, **kwargs)[source]
Bases:
MetaDataWithOwnershipModelSerializerSerializer for the PluginMeta model.
This serializer provides a camelCase API for plugin metadata, including fields for name, account, description, plugin class, version, user_profile, and tags. It is used to serialize and deserialize plugin metadata for API responses and requests.
- Parameters:
tags (TagListSerializerField) – List of tags associated with the plugin.
user_profile (UserProfileSerializer) – The user profile of the plugin user_profile (read-only).
- Returns:
Serialized plugin metadata.
- Return type:
Important
The user_profile field is read-only and cannot be modified via API requests.
See also
PluginMetaTagListSerializerFieldUserProfileSerializer
Example usage:
from smarter.apps.llmtool.serializers import PluginMetaSerializer from smarter.apps.llmtool.models import PluginMeta plugin = PluginMeta.objects.first() serializer = PluginMetaSerializer(plugin) print(serializer.data) # Output: { # "name": "...", # "userProfile": {...}, # "description": "...", # "pluginClass": "...", # "version": "...", # "userProfile": {...}, # "annotations": {...}, # "tags": ["tag1", "tag2"] # }
- class smarter.apps.llmtool.serializers.PluginPromptSerializer(*args, **kwargs)[source]
Bases:
SmarterCamelCaseSerializerSerializer for the PluginPrompt model.
This serializer exposes prompt configuration fields for plugins, including provider, system role, model, temperature, and max tokens (mapped from max_completion_tokens). It is used to serialize and deserialize prompt settings for plugin APIs.
- Parameters:
provider (str) – The name of the prompt provider (e.g., “openai”).
system_role (str) – The system role for the prompt context.
model (str) – The model name used for the prompt.
temperature (float) – The temperature setting for prompt generation.
max_tokens (int) – The maximum number of completion tokens (from max_completion_tokens).
- Returns:
Serialized plugin prompt configuration.
- Return type:
Note
The max_tokens field is mapped from the model’s max_completion_tokens attribute.
See also
PluginPrompt
Example usage:
from smarter.apps.llmtool.serializers import PluginPromptSerializer from smarter.apps.llmtool.models import PluginPrompt prompt = PluginPrompt.objects.first() serializer = PluginPromptSerializer(prompt) print(serializer.data) # Output: { # "provider": "...", # "systemRole": "...", # "model": "...", # "temperature": ..., # "maxTokens": ... # }
- class smarter.apps.llmtool.serializers.PluginSelectorSerializer(*args, **kwargs)[source]
Bases:
SmarterCamelCaseSerializerSerializer for the PluginSelector model.
This serializer exposes plugin selector directives and search terms in camelCase format for API responses. It is used to serialize and deserialize plugin selector configuration, typically for UI or API integration.
- Parameters:
- Returns:
Serialized plugin selector data.
- Return type:
Important
The searchTerms field is derived from the plugin specification and may be required for search-based selection.
See also
PluginSelectorSAMPluginCommonSpecSelectorKeyDirectiveValues
Example usage:
from smarter.apps.llmtool.serializers import PluginSelectorSerializer from smarter.apps.llmtool.models import PluginSelector selector = PluginSelector.objects.first() serializer = PluginSelectorSerializer(selector) print(serializer.data) # Output: { # "directive": "...", # "searchTerms": "..." # }
- class smarter.apps.llmtool.serializers.PluginSerializer(*args, **kwargs)[source]
Bases:
PluginMetaSerializerSerializer for the PluginMeta model, including nested serializers for plugin configuration.
This serializer provides a comprehensive representation of a plugin, including its metadata and associated configuration for selectors, prompts, static data, SQL data, and API data. It is used to serialize and deserialize complete plugin information for API responses and requests.
- class smarter.apps.llmtool.serializers.PluginSkillSerializer(*args, **kwargs)[source]
Bases:
SmarterCamelCaseSerializerSerializer for the PluginDataSkill model.
This serializer handles SKILL.md-format plugin data, exposing fields for description, the raw skill_document (YAML frontmatter + Markdown instructions), the parsed metadata, the denormalized allowed_tools list, and any bundled resource references. It is used to serialize and deserialize skill plugin configuration for API endpoints.
- Parameters:
description (str) – A brief description of the skill plugin.
skill_document (str) – The raw SKILL.md document (frontmatter + Markdown body) for the plugin.
metadata (dict) – Parsed YAML frontmatter from skill_document (name, description, license, allowed-tools).
allowed_tools (list) – The list of tool names this skill is permitted to invoke.
resources (dict) – The skill’s bundled files (scripts/, references/, assets/), keyed by path relative to the skill root. A null value denotes a file whose contents are unavailable, such as a binary asset.
source_url (str) – The URL from which the skill was retrieved, for remotely sourced skills.
source_retrieved_at (datetime) – When a remotely sourced skill was last retrieved.
- Returns:
Serialized skill plugin data.
- Return type:
See also
PluginDataSkill
Example usage:
from smarter.apps.llmtool.serializers import PluginSkillSerializer from smarter.apps.llmtool.models import PluginDataSkill skill_plugin = PluginDataSkill.objects.first() serializer = PluginSkillSerializer(skill_plugin) print(serializer.data) # Output: { # "description": "...", # "skillDocument": "---\nname: code-review\n...", # "metadata": {"name": "code-review", "description": "...", "allowed-tools": "Read Grep"}, # "allowedTools": ["Read", "Grep"], # "resources": {"references/checklist.md": "# Review checklist ..."}, # "sourceUrl": null, # "sourceRetrievedAt": null # }
- class smarter.apps.llmtool.serializers.PluginSqlSerializer(*args, **kwargs)[source]
Bases:
SmarterCamelCaseSerializerSerializer for the PluginDataSql model.
This serializer exposes SQL plugin configuration fields, including the connection, description, parameters, SQL query, test values, and result limit. It is used to serialize and deserialize SQL plugin settings for API endpoints.
- Parameters:
- Returns:
Serialized SQL plugin configuration.
- Return type:
Note
The connection field uses a slug related to the connection name and must reference an existing SqlConnection.
See also
PluginDataSqlSqlConnection
Example usage:
from smarter.apps.llmtool.serializers import PluginSqlSerializer from smarter.apps.llmtool.models import PluginDataSql sql_plugin = PluginDataSql.objects.first() serializer = PluginSqlSerializer(sql_plugin) print(serializer.data) # Output: { # "connection": "...", # "description": "...", # "parameters": {...}, # "sqlQuery": "...", # "testValues": {...}, # "limit": ... # }
- queryset = []
- class smarter.apps.llmtool.serializers.PluginStaticSerializer(*args, **kwargs)[source]
Bases:
SmarterCamelCaseSerializerSerializer for the PluginDataStatic model.
This serializer handles static plugin data, exposing the static_data field, which is rendered as
spec.dataof a StaticPlugin manifest. The model’s description is not exposed, since it is redundant withmetadata.descriptionof the manifest.- Parameters:
static_data (dict or str) – Arbitrary static data associated with the plugin.
- Returns:
Serialized static plugin data.
- Return type:
See also
PluginDataStatic
Example usage:
from smarter.apps.llmtool.serializers import PluginStaticSerializer from smarter.apps.llmtool.models import PluginDataStatic static_plugin = PluginDataStatic.objects.first() serializer = PluginStaticSerializer(static_plugin) print(serializer.data) # Output: { # "staticData": {...} # }
- class smarter.apps.llmtool.serializers.PluginWebsearchSerializer(*args, **kwargs)[source]
Bases:
SmarterCamelCaseSerializerSerializer for the PluginDataWebsearch model.
Experimental.
This serializer exposes the configuration of a WebsearchPlugin: its web search API, the Secret that contains the api key, search options, web page reading options, domain policy, timeout and cache duration. The api key is serialized as the name of its Secret, never its value.
Example usage:
serializer = PluginWebsearchSerializer(PluginDataWebsearch.objects.first()) print(serializer.data) # Output: { # "description": "...", # "searchProvider": "brave", # "searchApiKey": "brave_search_api_key", # "searchMaxResults": 5, # "fetchEnabled": true, # "allowedDomains": [], # ... # }
Note
Experimental. The WebsearchPlugin was designed and coded by Claude Code (Anthropic’s Claude Opus 5.5), with Lawrence McDaniel as co-author. It is experimental, and will be documented.
- smarter.apps.llmtool.serializers.is_sphinx_build()[source]