Web Console Views

The JSON API of the React Vectorstore list in the web console: list, clone, rename and delete.

smarter.apps.vectorstore.views.listview.api.SORT_FIELDS = {'createdAt': 'created_at', 'database': 'backend', 'description': 'description', 'name': 'name', 'updatedAt': 'updated_at', 'vectorCount': 'vector_count'}

The columns of the Vectorstore list that it may be sorted by, and the fields that sort them.

{
    'createdAt': 'created_at',
    'database': 'backend',
    'description': 'description',
    'name': 'name',
    'updatedAt': 'updated_at',
    'vectorCount': 'vector_count',
}
class smarter.apps.vectorstore.views.listview.api.VectorstoreListApiCloneView(**kwargs)[source]

Bases: SmarterAuthenticatedNeverCachedWebView

Clone a vectorstore: a new, undeployed vectorstore with the same spec, owned by the user.

Its documents and database are not copied. Deploy it, and add documents, to use it.

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

Clone the vectorstore that the user may read, as new_name, and invalidate the user’s cached vectorstores.

Parameters:
  • request (HttpRequest) – The request.

  • kwargs – The url’s vectorstore_id and new_name.

Return type:

JsonResponse

Returns:

The clone, 400 if new_name is empty, 404 if the vectorstore is not found, or 409 if the user has a vectorstore named new_name.

class smarter.apps.vectorstore.views.listview.api.VectorstoreListApiDeleteView(**kwargs)[source]

Bases: SmarterAuthenticatedNeverCachedWebView

Destroy a vectorstore’s database and data, unless deletionProtection is enabled, then delete it.

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

Destroy the database of the vectorstore that the user owns, if it was deployed, then delete it and its API key Secret.

Parameters:
  • request (HttpRequest) – The request.

  • kwargs – The url’s vectorstore_id.

Return type:

JsonResponse

Returns:

A message, 404 if the vectorstore is not found, or 400 if it could not be deleted, e.g. because of deletionProtection.

class smarter.apps.vectorstore.views.listview.api.VectorstoreListApiRenameView(**kwargs)[source]

Bases: SmarterAuthenticatedNeverCachedWebView

Rename a vectorstore.

Its database keeps its index name, and its server its Kubernetes name.

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

Rename the vectorstore that the user owns to new_name, and invalidate the user’s cached vectorstores.

Parameters:
  • request (HttpRequest) – The request.

  • kwargs – The url’s vectorstore_id and new_name.

Return type:

JsonResponse

Returns:

The vectorstore, 400 if new_name is empty, 404 if the vectorstore is not found, or 409 if a vectorstore named new_name exists.

class smarter.apps.vectorstore.views.listview.api.VectorstoreListApiView(**kwargs)[source]

Bases: SmarterListApiView

The vectorstores that the user owns, those shared with them, or both.

listview_cache_kind: ClassVar[str] = 'Vectorstore'

The list’s name in the cache, as connect_listview_cache() invalidates it, e.g. LLMClient.

model

alias of VectorstoreMeta

serializer_class

alias of VectorstoreSerializer

sort_fields: ClassVar[Mapping[str, str]] = {'createdAt': 'created_at', 'database': 'backend', 'description': 'description', 'name': 'name', 'updatedAt': 'updated_at', 'vectorCount': 'vector_count'}

The columns that the list may be sorted by.

See paginate_queryset().

The Vectorstore list page, /vectorstore/, which the single-page console serves (ADR-035).

The console renders @smarter/vectorstore-list’s list at the page’s path, and the list calls its list api, smarter.apps.vectorstore.views.listview.api. The page keeps its view class, named after the list api’s, which smarter.lib.django.listview.listview_registry() pairs it with, so that the dashboard’s global search links to it.

class smarter.apps.vectorstore.views.listview.view.VectorstoreListView(**kwargs)[source]

Bases: ConsoleAppView

The Vectorstore list page: the single-page console’s, at the path that Django served it at.

A Vectorstore’s manifest page, /vectorstore/vectors/<hashed id>/, which the single-page console serves (ADR-035).

The console shows the resource’s manifest in the manifest editor, from the dashboard’s resource api, smarter.apps.dashboard.resource_detail, which finds it by its record locator if the user may read it. The page keeps its view class and url name, which smarter.lib.manifest.record_locator.console_paths() reverses.

class smarter.apps.vectorstore.views.detailview.VectorstoreDetailView(**kwargs)[source]

Bases: ConsoleAppView

A Vectorstore’s manifest page: the single-page console’s, at the path that Django served it at.