pub enum Prompt {
Text(String),
Audio {
audio: String,
transcript: Option<String>,
},
}Expand description
What a component speaks: TTS text (a bare string) or a reference to a pre-rendered audio asset shipped alongside the flow.
JSON schema
{
"description": "What a component speaks: TTS text (a bare string) or a reference to a pre-rendered audio asset shipped alongside the flow.",
"oneOf": [
{
"title": "Text",
"type": "string"
},
{
"title": "Audio",
"type": "object",
"required": [
"audio"
],
"properties": {
"audio": {
"description": "Audio asset ref. A generated-clip ref is a voice_prompts id matching ^vprompt_[a-z0-9]+$.",
"type": "string"
},
"transcript": {
"description": "The words this pre-rendered clip speaks — the text it was synthesized from — carried so a viewer can show what a caller hears, and for traces. Advisory only: playback always uses `audio`, never this. Optional and forward-added: absent on older documents and on refs the platform did not generate from text.",
"type": "string"
}
}
}
]
}Variants§
Text(String)
Audio
Fields
audio: StringAudio asset ref. A generated-clip ref is a voice_prompts id matching ^vprompt_[a-z0-9]+$.
transcript: Option<String>The words this pre-rendered clip speaks — the text it was synthesized from — carried so a viewer can show what a caller hears, and for traces. Advisory only: playback always uses audio, never this. Optional and forward-added: absent on older documents and on refs the platform did not generate from text.
Implementations§
Source§impl Prompt
impl Prompt
Sourcepub fn as_text(&self) -> Option<&str>
pub fn as_text(&self) -> Option<&str>
The synthesizable text: Some for a bare-string prompt the engine
speaks with TTS, None for an audio-asset prompt it plays as a clip.
This drives playback branching and the length cap — an audio prompt’s
transcript, when present, is not returned here (it is display text,
not something to synthesize or bound). For the human-readable words
either kind speaks, use Prompt::transcript.
Sourcepub fn transcript(&self) -> Option<&str>
pub fn transcript(&self) -> Option<&str>
The human-readable words this prompt speaks, for display (a “what the
caller hears” transcript) and traces — regardless of how it is voiced.
A text prompt is its own transcript; an audio prompt carries the text
it was synthesized from in transcript, None when the document omits
it (older flows, or a ref not generated from text). Unlike as_text,
this is never used to decide playback or enforce the length cap.