Prompt Manifest View

An llmclient’s manifest: its page, which the single-page console renders, and its JSON, for the workbench.

LLMClientDetailView is the page, and LLMClientManifestEditorView returns the manifest as JSON for the Prompt Engineer’s Workbench’s Manifest tab.

class smarter.apps.prompt.views.detailviews.prompt_manifest_view.LLMClientDetailView(**kwargs)[source]

Bases: ConsoleAppView

An llmclient’s manifest page, /workbench/llm-clients/<hashed_id>/manifest/: the single-page console’s.

The console reads the manifest from the resource api, which finds the llmclient if the user may read it, as for every other kind’s manifest page. Django keeps this view at the path it served the page at, so that its url name, and LLMClient.manifest_url, still reverse.

class smarter.apps.prompt.views.detailviews.prompt_manifest_view.LLMClientManifestEditorView(**kwargs)[source]

Bases: SmarterAuthenticatedNeverCachedWebView

Returns an llmclient’s manifest, as JSON, for the manifest editor of the Prompt Engineer’s Workbench.

The workbench, @smarter/workbench, renders the @smarter/manifest-editor component in its Console’s “Manifest” tab, and fetches the manifest from this view when the tab is first opened. The manifest is the one that the resource api returns, the cli api’s describe as the llmclient’s owner (smarter.apps.dashboard.resource_detail.manifest_yaml()). The editor saves it with the cli api, as the signed-in user, and the workbench then reloads the llmclient’s configuration.

A user who may not read the llmclient gets the same 404 as for an unknown id, by the rule of the workbench’s other tabs (readable_llmclient()): e.g. another account’s llmclient, or a staff-only one for a user who is not the platform’s staff.

Example usage:

GET /api/web/prompt/llm-clients/<str:hashed_id>/manifest/
{"manifest": "apiVersion: smarter.sh/v1\nkind: LLMClient\n..."}
property formatted_class_name: str

Returns a formatted string of the class name for logging purposes.

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

Return the llmclient’s manifest, as YAML in JSON: {"manifest": "<yaml>"}.

Parameters:
  • request (HttpRequest) – The request.

  • args – Additional positional arguments.

  • kwargs – The url’s keyword arguments: hashed_id.

Returns:

The manifest; {"error": ...}, a 404, for an unknown llmclient or one that the user may not read; or {"error": ...}, a 500, if the llmclient can’t be described.

Return type:

HttpResponse

smarter.apps.prompt.views.detailviews.prompt_manifest_view.should_log(level)[source]

Check if logging should be done based on the waffle switch.