Skip to content

API Reference parrot_formdesigner.audio.narration.engine

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_formdesigner.audio.narration.engine

View source

Deterministic narration for audio forms (FEAT-649, Module 3).

Alias AudioQuestion

Re-exported from parrot_formdesigner.audio.models.AudioQuestion.

Alias FieldType

Re-exported from parrot_formdesigner.core.types.FieldType.

Alias FieldVoiceMeta

Re-exported from parrot_formdesigner.core.voice.FieldVoiceMeta.

Attribute NARRATION_KEYS

Type: frozenset[str]

Alias NarrationPlan

Re-exported from parrot_formdesigner.audio.models.NarrationPlan.

Class Narrator

Render narration templates for one locale (sandboxed Jinja2, StrictUndefined).

Parameter Type Default Description
locale str
templates_dir Path | None None

Method Narrator.render

Render one template key; raises KeyError for an unknown key.

render(key: str, **ctx: Any) -> str

Parameter Type Default Description
key str
**ctx Any {}

Returns: str

Method Narrator.system_phrases

sys:* keys pre-synthesised at start_session.

system_phrases() -> dict[str, str]

Returns: dict[str, str]

Method Narrator.plan_question

label → pause: → hint → options (single segment) | options_intro + opt: with pauses.

plan_question(q: AudioQuestion, cfg: VoiceFormConfig, meta: FieldVoiceMeta) -> NarrationPlan

Parameter Type Default Description
q AudioQuestion
cfg VoiceFormConfig
meta FieldVoiceMeta

Returns: NarrationPlan

Method Narrator.plan_review

review_intro + one review_item / review_item_skipped per item (sensitive → "[hidden]").

plan_review(items: list[ReviewItemData], cfg: VoiceFormConfig) -> NarrationPlan

Parameter Type Default Description
items list[ReviewItemData]
cfg VoiceFormConfig

Returns: NarrationPlan

Alias ReviewItemData

Re-exported from parrot_formdesigner.audio.models.ReviewItemData.

Alias VoiceFormConfig

Re-exported from parrot_formdesigner.core.voice.VoiceFormConfig.

Alias locale_chain

Re-exported from parrot_formdesigner.audio.narration.lexicon.locale_chain.

Alias locale_document_path

Re-exported from parrot_formdesigner.audio.narration.lexicon.locale_document_path.

Function render_author_prompt

Render an author prompt with str.format_map over a whitelist (never Jinja).

Unknown placeholders are rendered verbatim; malformed format strings return the prompt unchanged.

render_author_prompt(prompt: str, *, label: str, hint: str, section: str, n: int, total: int) -> str

Parameter Type Default Description
prompt str
label str
hint str
section str
n int
total int

Returns: str

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally