gmuse._docs.template_extractor#
Template extraction utilities for documentation generation.
This module is used by Sphinx extensions and tests to keep documentation in sync with the canonical prompt templates in gmuse.
Module Contents#
Classes#
An extracted prompt template. |
|
Information about a context input. |
Functions#
Return the current canonical prompt version. |
|
Extract the system prompt template. |
|
Extract the task prompt for a given output format. |
|
Extract all canonical templates used in documentation. |
|
Return the canonical list of context inputs used for documentation. |
|
Validate that all required templates are extractable and non-empty. |
Data#
API#
- class gmuse._docs.template_extractor.ExtractedTemplate#
An extracted prompt template.
- name: str = None#
- content: str = None#
- description: str = None#
- class gmuse._docs.template_extractor.ContextInputInfo#
Information about a context input.
- name: str = None#
- description: str = None#
- condition: str = None#
- is_optional: bool = None#
- gmuse._docs.template_extractor.TemplateGetter = None#
- gmuse._docs.template_extractor.TemplateSpec = None#
- gmuse._docs.template_extractor._TEMPLATE_SPECS: dict[str, gmuse._docs.template_extractor.TemplateSpec] = None#
- gmuse._docs.template_extractor.get_prompt_version() str#
Return the current canonical prompt version.
This is sourced directly from
gmuse.prompts.PROMPT_VERSION.
- gmuse._docs.template_extractor._extract_template(name: str) gmuse._docs.template_extractor.ExtractedTemplate#
- gmuse._docs.template_extractor.extract_system_prompt() gmuse._docs.template_extractor.ExtractedTemplate#
Extract the system prompt template.
- gmuse._docs.template_extractor.extract_format_task(format_name: str) gmuse._docs.template_extractor.ExtractedTemplate#
Extract the task prompt for a given output format.
- Args:
format_name: One of
freeform,conventional, orgitmoji.- Raises:
ValueError: If
format_nameis unknown.
- gmuse._docs.template_extractor.extract_all_templates() dict[str, gmuse._docs.template_extractor.ExtractedTemplate]#
Extract all canonical templates used in documentation.
- gmuse._docs.template_extractor.get_context_inputs() list[gmuse._docs.template_extractor.ContextInputInfo]#
Return the canonical list of context inputs used for documentation.
This is intentionally a small, explicit list rather than trying to introspect runtime behavior. It should stay aligned with the context assembled by gmuse for suggestion requests.
- gmuse._docs.template_extractor.validate_templates() None#
Validate that all required templates are extractable and non-empty.
This is designed to be called during documentation builds; failures should be actionable and point at the missing or empty template.