Views

LLMClient api/v1/llmclients CRUD views.

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

Bases: ListViewBase

LLMClientAPIKey list view for smarter api.

contract_model

alias of LLMClientApiKey

get_queryset(*args, **kwargs)[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)

serializer_class

alias of LLMClientAPIKeySerializer

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

Bases: ViewBase

LLMClientAPIKey view for smarter api.

delete(request, llmclient_id, apikey_id)[source]
get(request, llmclient_id, apikey_id)[source]
post(request, llmclient_id, apikey_id=None)[source]
serializer_class

alias of LLMClientAPIKeySerializer

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

Bases: ListViewBase

LLMClientCustomDomain list view for smarter api.

contract_model

alias of LLMClientApiCustomDomain

get_queryset(*args, **kwargs)[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)

serializer_class

alias of LLMClientCustomDomainSerializer

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

Bases: ViewBase

LLMClientCustomDomain view for smarter api.

delete(request, llmclient_id, customdomain_id)[source]

Detach the custom domain from the LLMClient.

The domain itself is kept: LLMClient.custom_domain is on_delete=CASCADE, so deleting the domain would delete the LLMClient too.

get(request, llmclient_id, customdomain_id)[source]
post(request, llmclient_id, customdomain_id)[source]

Attach the custom domain to the LLMClient, through LLMClient.custom_domain.

serializer_class

alias of LLMClientCustomDomainSerializer

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

Bases: ViewBase

LLMClient deployment view for smarter api.

post(request, llmclient_id)[source]
serializer_class

alias of LLMClientSerializer

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

Bases: ListViewBase

LLMClientFunctions list view for smarter api.

contract_model

alias of LLMClientApiFunction

get_queryset(*args, **kwargs)[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)

serializer_class

alias of LLMClientFunctionsSerializer

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

Bases: ViewBase

LLMClientFunctions view for smarter api.

delete(request, llmclient_id, function_id)[source]
get(request, llmclient_id, function_id)[source]
patch(request, llmclient_id, function_id)[source]
post(request, llmclient_id)[source]
serializer_class

alias of LLMClientFunctionsSerializer

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

Bases: ListViewBase

LLMClient list view for smarter api.

dispatch(request, *args, **kwargs)[source]

Extend DRF dispatch() to add authentication checks and logging.

Parameters:

request (Request) – The incoming HTTP request.

Returns:

The HTTP response generated by the view.

Return type:

HttpResponse

Raises:
  • AuthenticationFailed – Raised when authentication fails.

  • SmarterTokenAuthenticationError – Raised for errors specific to SmarterTokenAuthentication.

get_queryset(*args, **kwargs)[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]

An LLMClient of the response, whose canDelete is the requesting user’s.

llmclients: QuerySet | None
serializer_class

alias of LLMClientSerializer

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

Bases: ListViewBase

LLMClientPlugin list view for smarter api.

get_queryset(*args, **kwargs)[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 LLMClientPluginSerializer

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

Bases: ViewBase

LLMClientPlugin view for smarter api.

delete(request, llmclient_id, plugin_id)[source]
get(request, llmclient_id, plugin_id)[source]
patch(request, llmclient_id, plugin_id)[source]
post(request, llmclient_id)[source]
serializer_class

alias of LLMClientPluginSerializer

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

Bases: ViewBase

LLMClient view for smarter api.

delete(request, *args, llmclient_id=None, **kwargs)[source]
dispatch(request, *args, **kwargs)[source]

Extend DRF dispatch() to add logging and signals.

Parameters:

request (Request) – The incoming HTTP request.

Raises:
  • AuthenticationFailed – Raised when authentication fails.

  • SmarterTokenAuthenticationError – Raised for errors specific to SmarterTokenAuthentication.

get(request, llmclient_id=None)[source]
get_queryset(*args, **kwargs)[source]
hashed_id: str | None = None
initial(request, *args, **kwargs)[source]

Find the LLMClient, after DRF has authenticated the request and before the handler runs.

llmclient: LLMClient | None = None
llmclient_id: int | None = None
patch(request, *args, llmclient_id=None, **kwargs)[source]
post(request, *args, **kwargs)[source]
serializer_class

alias of LLMClientSerializer

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

Bases: ContractListMixin, SmarterAdminListAPIView

Base class for all llmclient list views.

A subclass sets contract_model, the model of smarter.apps.llmclient.contract.models that each row of its response is built with.

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

Bases: SmarterAdminAPIView

Base class for all llmclient detail views.

Their GET responses are built from the models of smarter.apps.llmclient.contract.models, which the Smarter api’s OpenAPI document publishes.