Views
LLMClient api/v1/llmclients CRUD views.
- class smarter.apps.llmclient.api.v1.views.views.LLMClientAPIKeyListView(*args, **kwargs)[source]
Bases:
ListViewBaseLLMClientAPIKey list view for smarter api.
- contract_model
alias of
LLMClientApiKey
- get_queryset(*args, **kwargs)[source]
Return the api keys of the account’s LLMClient named by the url’s
llmclient_id.- Returns:
The LLMClientAPIKey rows, with their tokens.
- Raises:
Http404 – when the account has no such LLMClient.
- serializer_class
alias of
LLMClientAPIKeySerializer
- class smarter.apps.llmclient.api.v1.views.views.LLMClientAPIKeyView(*args, **kwargs)[source]
Bases:
ViewBaseLLMClientAPIKey view for smarter api.
- delete(request, llmclient_id, apikey_id)[source]
Unlink an api key from the account’s LLMClient, and redirect to the list url.
- get(request, llmclient_id, apikey_id)[source]
Return an api key of the account’s LLMClient as an
LLMClientApiKey.
- post(request, llmclient_id, apikey_id=None)[source]
Link a SmarterAuthToken to the account’s LLMClient, and redirect to the new link.
- serializer_class
alias of
LLMClientAPIKeySerializer
- class smarter.apps.llmclient.api.v1.views.views.LLMClientCustomDomainListView(*args, **kwargs)[source]
Bases:
ListViewBaseLLMClientCustomDomain list view for smarter api.
- contract_model
alias of
LLMClientApiCustomDomain
- get_queryset(*args, **kwargs)[source]
Return the custom domain of the account’s LLMClient named by the url’s
llmclient_id.- Returns:
The LLMClientCustomDomain rows, zero or one.
- Raises:
Http404 – when the account has no such LLMClient.
- serializer_class
alias of
LLMClientCustomDomainSerializer
- class smarter.apps.llmclient.api.v1.views.views.LLMClientCustomDomainView(*args, **kwargs)[source]
Bases:
ViewBaseLLMClientCustomDomain 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]
Return the account LLMClient’s custom domain as an
LLMClientApiCustomDomain.
- post(request, llmclient_id, customdomain_id)[source]
Attach the custom domain to the LLMClient, through LLMClient.custom_domain.
If the LLMClient is deployed and the domain is verified, queues
deploy_custom_api()to serve it on its custom host.
- serializer_class
alias of
LLMClientCustomDomainSerializer
- class smarter.apps.llmclient.api.v1.views.views.LLMClientDeployView(*args, **kwargs)[source]
Bases:
ViewBaseLLMClient deployment view for smarter api.
- post(request, llmclient_id)[source]
Mark the account’s LLMClient deployed, and save it.
Saving it sends the LLMClient’s signals, whose receivers deploy it.
- Parameters:
request (
Request) – The request.llmclient_id (
int) – The id of the LLMClient.
- Returns:
An empty 200 response, or 400 if the save fails.
- serializer_class
alias of
LLMClientSerializer
- class smarter.apps.llmclient.api.v1.views.views.LLMClientExtensionsListView(*args, **kwargs)[source]
Bases:
ListViewBaseLLMClientExtensions list view for smarter api.
- contract_model
alias of
LLMClientApiExtension
- get_queryset(*args, **kwargs)[source]
Return the extensions of the account’s LLMClient named by the url’s
llmclient_id, sorted by slug.- Returns:
The LLMClientExtensions rows, with their Extensions.
- Raises:
Http404 – when the account has no such LLMClient.
- serializer_class
alias of
LLMClientExtensionsSerializer
- class smarter.apps.llmclient.api.v1.views.views.LLMClientExtensionsView(*args, **kwargs)[source]
Bases:
ViewBaseLLMClientExtensions view for smarter api.
- delete(request, llmclient_id, extension_id)[source]
Remove an extension from the account’s LLMClient, and redirect to the list url.
- get(request, llmclient_id, extension_id)[source]
Return an extension of the account’s LLMClient as an
LLMClientApiExtension.
- serializer_class
alias of
LLMClientExtensionsSerializer
- class smarter.apps.llmclient.api.v1.views.views.LLMClientListView(*args, **kwargs)[source]
Bases:
ListViewBaseLLMClient list view for smarter api.
- dispatch(request, *args, **kwargs)[source]
Dispatch the request, then, if it succeeded, set
llmclientsto those the user can read.- Parameters:
request (
HttpRequest) – The request.- Returns:
The response.
- get_queryset(*args, **kwargs)[source]
Return the LLMClients that the user has read permission for.
- Returns:
The LLMClients.
- serializer_class
alias of
LLMClientSerializer
- class smarter.apps.llmclient.api.v1.views.views.LLMClientPluginListView(*args, **kwargs)[source]
Bases:
ListViewBaseLLMClientPlugin list view for smarter api.
- get_queryset(*args, **kwargs)[source]
Return the plugins of the account’s LLMClient named by the url’s
llmclient_id.- Returns:
The LLMClientPlugin rows.
- Raises:
Http404 – when the account has no such LLMClient.
- serializer_class
alias of
LLMClientPluginSerializer
- class smarter.apps.llmclient.api.v1.views.views.LLMClientPluginView(*args, **kwargs)[source]
Bases:
ViewBaseLLMClientPlugin view for smarter api.
- delete(request, llmclient_id, plugin_id)[source]
Remove a plugin from the account’s LLMClient, and redirect to the list url.
- get(request, llmclient_id, plugin_id)[source]
Return a plugin of the account’s LLMClient as an
LLMClientApiPlugin.
- patch(request, llmclient_id, plugin_id)[source]
Reload a plugin of the account’s LLMClient from the request’s json body, and redirect to it.
- post(request, llmclient_id)[source]
Add a plugin to the account’s LLMClient, from the request’s data, and redirect to it.
- Parameters:
request (
Request) – The request, whose data is passed toLLMClientPlugin.load().llmclient_id (
int) – The id of the LLMClient.
- Returns:
A redirect to the new LLMClientPlugin, or a 400 response if it could not be loaded.
- serializer_class
alias of
LLMClientPluginSerializer
- class smarter.apps.llmclient.api.v1.views.views.LLMClientView(*args, **kwargs)[source]
Bases:
ViewBaseLLMClient view for smarter api.
- delete(request, *args, llmclient_id=None, **kwargs)[source]
Delete the LLMClient, and redirect to the list url.
A superuser can delete any LLMClient by
llmclient_id; anyone else deletes the view’s LLMClient.
- dispatch(request, *args, **kwargs)[source]
Pop
hashed_idfrom the url kwargs, then dispatch the request.- Parameters:
request (
HttpRequest) – The request.- Returns:
The response.
- get(request, llmclient_id=None)[source]
Return the LLMClient as an
LLMClientApiLLMClient.
- get_queryset(*args, **kwargs)[source]
Return a queryset of the view’s LLMClient.
- Returns:
The LLMClient found by
initial(), as a one-row queryset.
- initial(request, *args, **kwargs)[source]
Find the LLMClient, after DRF has authenticated the request and before the handler runs.
- patch(request, *args, llmclient_id=None, **kwargs)[source]
Set the request’s fields on the LLMClient, save it, and redirect to its detail url.
Keys that are not attributes of the LLMClient are ignored.
- Parameters:
- Returns:
A redirect to the LLMClient; 404 if there is none; 400 if the data is not a dict or fails validation; 500 if the save fails.
- post(request, *args, **kwargs)[source]
Create an LLMClient from the request’s data, and redirect to its detail url.
- Parameters:
request (
Request) – The request, whose data are the LLMClient’s field values.- Returns:
A redirect to the new LLMClient, or a 400 response if it could not be created.
- serializer_class
alias of
LLMClientSerializer
- class smarter.apps.llmclient.api.v1.views.views.ListViewBase(*args, **kwargs)[source]
Bases:
ContractListMixin,SmarterAdminListAPIViewBase class for all llmclient list views.
A subclass sets
contract_model, the model ofsmarter.apps.llmclient.contract.modelsthat each row of its response is built with.
- class smarter.apps.llmclient.api.v1.views.views.ViewBase(*args, **kwargs)[source]
Bases:
SmarterAdminAPIViewBase 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.