Urls

Django URL patterns for the prompt app: the Prompt Engineer’s Workbench, at /workbench/.

The workbench’s pages, an LLMClient’s manifest page, and the LLMClient’s chat configuration, which Smarter Chat also reads from the public api, /api/v1/llm-clients/<hashed_id>/config/. The endpoints that the workbench’s React app calls are in the web console’s api, at /api/web/prompt/: see smarter.apps.prompt.api.web.urls.

class smarter.apps.prompt.urls.PromptReverseNames[source]

Bases: object

Reverse views for the Prompt app.

Provides named references for reversing Prompt-related API endpoints.

This class is used for reverse URL resolution in Django, where each attribute corresponds to a Prompt command endpoint. The names are derived from the actual API view class names, ensuring consistency and reducing the risk of typos when using Django’s URL reversing features.

All Prompt endpoints in the Smarter platform are included as attributes of this class. This centralizes the reverse URL names for all Prompt endpoints, making it easier to maintain and reference them throughout the codebase. The endpoints that the LLMClient list page’s and the workbench’s React apps call are in the web console’s api: see smarter.apps.prompt.api.web.urls.PromptApiWebReverseNames.

Usage

Use these attributes with Django’s reverse() function or in templates to generate URLs for Prompt API endpoints based on the view class names.

Example

from smarter.lib.django.shortcuts import reverse
url = reverse(PromptReverseNames.describe, kwargs={'hashed_id': 'rMTAwMDAzOQx'})

# returns manifest of the llmclient with the given hashed_id
retval = PromptReverseNames.describe
print(retval)
chat_by_hashed_id = 'prompt_workbench_view'
config_by_hashed_id = 'prompt_config_view'
listview = 'prompt_list_view'
manifest_by_hashed_id = 'llm_client_detail_view'
namespace = 'prompt'
sandbox_by_hashed_id = 'prompt_sandbox_view'