Prompt Manifest View
LLMClientDetailView is a Django class-based view that renders a detail view of.
a SAM manifest for an llm_client.
- class smarter.apps.prompt.views.detailviews.prompt_manifest_view.LLMClientDetailView(**kwargs)[source]
Bases:
DocsBaseViewRenders the detail view for a Smarter llm_client.
This view renders a detailed manifest for a specific llm_client, including its configuration and metadata, in YAML format. It is intended for authenticated users and provides error handling for missing or unsupported llm_client kinds and names.
- Parameters:
- Returns:
Rendered HTML page with llm_client manifest details, or a 404 error page if the llm_client is not found or parameters are invalid.
- Return type:
HttpResponse
Note
The llm_client name and kind must be provided and valid. Otherwise, a “not found” response is returned.
See also
LLMClientfor llm_client retrieval.ApiV1CliDescribeApiViewfor API details.Example usage:
GET /llm-client/detail/?name=my_llm_client&kind=custom
- property formatted_class_name: str
Returns a formatted string of the class name for logging purposes.
- get(request, *args, **kwargs)[source]
Handle GET requests to render the llm_client manifest detail view.
This method processes the incoming request to retrieve the specified llm_client’s manifest details and renders them in a user-friendly format. It performs validation on the provided llm_client name and kind, retrieves the llm_client metadata, and handles any errors that may arise during this process.
Process: 1. Extract and validate ‘name’ and ‘kind’ from kwargs. 2. Retrieve the llm_client metadata using the provided name and user context. 3. If the llm_client is found, call the API view to get the llm_client details 4. Convert the JSON response to YAML format for better readability. 5. Render the llm_client manifest detail template with the retrieved data. 6. Handle any errors that occur during the process and return appropriate error responses.
- Parameters:
request (
HttpRequest) – Django HTTP request object.args (tuple) – Additional positional arguments.
kwargs (dict) – Keyword arguments, must include ‘name’ (llm_client name) and ‘kind’ (llm_client type).
- Returns:
Rendered HTML page with llm_client manifest details, or an error response if the llm_client is not found or parameters are invalid.
- Return type:
- llm_client_helper: LLMClientHelper | None = None