Views

PluginMeta views.

class smarter.apps.llmtool.api.v1.views.AddPluginExamplesView(*args, **kwargs)[source]

Bases: SmarterAuthenticatedAPIView

Add example plugins to a user profile.

post(request, user_id=None)[source]
class smarter.apps.llmtool.api.v1.views.PluginCloneView(*args, **kwargs)[source]

Bases: SmarterAuthenticatedAPIView

Plugin clone view for smarter api.

post(request, plugin_id, new_name)[source]
class smarter.apps.llmtool.api.v1.views.PluginListView(*args, **kwargs)[source]

Bases: ContractListMixin, SmarterAuthenticatedListAPIView

Plugins list view for smarter api.

contract_model

alias of PluginApiPluginMeta

get_queryset()[source]

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

item(row)[source]

A plugin of the response, whose canDelete is the requesting user’s.

serializer_class

alias of PluginMetaSerializer

class smarter.apps.llmtool.api.v1.views.PluginUploadView(*args, **kwargs)[source]

Bases: SmarterAuthenticatedAPIView

Plugin view for smarter api.

static parse_yaml_file(data)[source]
parser_class = (<class 'rest_framework.parsers.FileUploadParser'>,)
post(request)[source]
put(request)[source]
class smarter.apps.llmtool.api.v1.views.PluginView(*args, **kwargs)[source]

Bases: SmarterAuthenticatedAPIView

Plugin view for smarter api.

delete(request, plugin_id)[source]
get(request, plugin_id)[source]
patch(request, plugin_id=None)[source]
post(request, plugin_id=None)[source]
put(request, plugin_id=None)[source]
smarter.apps.llmtool.api.v1.views.create_plugin(request, data=None)[source]

Create a plugin from a json representation in the body of the request.

smarter.apps.llmtool.api.v1.views.delete_plugin(request, plugin_id)[source]

Delete a plugin by id.

smarter.apps.llmtool.api.v1.views.get_plugin(request, plugin_id)[source]

Get a plugin’s manifest, by id, if the user may read the plugin.

A plugin that the user may not read is not found, so that the plugins of other accounts are not disclosed. Errors are Django REST framework’s {"detail": ...}.

smarter.apps.llmtool.api.v1.views.update_plugin(request, plugin_id=None)[source]

Update a plugin from a json representation in the body of the request.

Parameters:

plugin_id (int | None) – The id of the plugin to update, from the url. If provided, it must be the plugin that the manifest names.