pub struct Transcript {
pub lines: Vec<TranscriptLine>,
}Expand description
Accumulates transcript lines over the life of a call.
Fields§
§lines: Vec<TranscriptLine>The ordered transcript lines.
Implementations§
Source§impl Transcript
impl Transcript
Sourcepub fn push_user(&mut self, text: &str)
pub fn push_user(&mut self, text: &str)
Append (or merge into) a user line from an input-transcription delta.
The realtime model streams transcription incrementally; consecutive deltas from the same speaker are appended into the current line so a rendered turn reads as one utterance. A speaker switch starts a new line.
Sourcepub fn push_bot(&mut self, text: &str)
pub fn push_bot(&mut self, text: &str)
Append (or merge into) a bot line from an output-transcription delta.
Sourcepub fn user_turns(&self) -> u64
pub fn user_turns(&self) -> u64
Number of user turns (merged user lines) — reported as
usage_metrics.user_turns for the Run-detail “User Turns” metric.
Sourcepub fn bot_turns(&self) -> u64
pub fn bot_turns(&self) -> u64
Number of bot turns (merged bot lines) — reported as
usage_metrics.bot_turns. (Transition markers ride on a bot line, so this
is the count of bot utterances including any folded transition note.)
Sourcepub fn render(&self) -> Vec<u8> ⓘ
pub fn render(&self) -> Vec<u8> ⓘ
Render the transcript as a JSON array of {role, text} turns.
role is the lowercase speaker ("user"/"bot"). Never panics —
serialization of this owned shape cannot fail, but on the off chance it
did we fall back to an empty array so a finalize can still proceed.