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#

ExtractedTemplate

An extracted prompt template.

ContextInputInfo

Information about a context input.

Functions#

get_prompt_version

Return the current canonical prompt version.

_extract_template

extract_system_prompt

Extract the system prompt template.

extract_format_task

Extract the task prompt for a given output format.

extract_all_templates

Extract all canonical templates used in documentation.

get_context_inputs

Return the canonical list of context inputs used for documentation.

validate_templates

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, or gitmoji.

Raises:

ValueError: If format_name is 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.