pub struct Transcript {
pub text: Arc<str>,
pub role: Role,
pub finality: Finality,
}Expand description
A piece of conversation text flowing through the pipeline: speech-to-text output, language-model output, or text bound for TTS.
§The stable-prefix invariant
For a given utterance (a Role::User unit) or generation (a
Role::Agent unit), the bytes text[..stable] never change across
successive partials: once a prefix is declared stable it is frozen, and only
the tail beyond stable may be revised or grow. Downstream stages rely on
this to commit settled text early instead of waiting for
Finality::Final.
stable is a byte index into text and must lie on a char boundary. STT
partials revise their tail, so stable <= text.len(); LM partials are
append-only, so stable == text.len(). A Finality::Final transcript
carries no stable — the whole text is settled.
Fields§
§text: Arc<str>The transcript text so far. For a Finality::Partial this is the
current best guess; only text[..stable] is guaranteed frozen.
role: RoleWho produced this text — Role::User (STT) or Role::Agent (LM).
finality: FinalityWhether this is an in-progress Finality::Partial or the completed
Finality::Final unit.
Implementations§
Source§impl Transcript
impl Transcript
Sourcepub fn user_partial(text: impl Into<Arc<str>>, stable: usize) -> Self
pub fn user_partial(text: impl Into<Arc<str>>, stable: usize) -> Self
An in-progress user (STT) transcript: the first stable bytes of text
are frozen and its tail may still be revised.
stable must be <= text.len() and lie on a char boundary; both are
debug-asserted.
Sourcepub fn user_final(text: impl Into<Arc<str>>) -> Self
pub fn user_final(text: impl Into<Arc<str>>) -> Self
A completed user utterance.
Sourcepub fn agent_partial(text: impl Into<Arc<str>>) -> Self
pub fn agent_partial(text: impl Into<Arc<str>>) -> Self
An in-progress agent (LM) transcript. LM output is append-only, so the
entire current text is stable (stable == text.len()).
Sourcepub fn agent_final(text: impl Into<Arc<str>>) -> Self
pub fn agent_final(text: impl Into<Arc<str>>) -> Self
A completed agent generation.
Trait Implementations§
Source§impl Clone for Transcript
impl Clone for Transcript
Source§fn clone(&self) -> Transcript
fn clone(&self) -> Transcript
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Transcript
impl Debug for Transcript
Source§impl From<Transcript> for DataFrame
impl From<Transcript> for DataFrame
Source§fn from(transcript: Transcript) -> Self
fn from(transcript: Transcript) -> Self
Wrap a Transcript as a DataFrame::Transcript so a stage can write
Transcript::user_final(text).into() instead of naming the variant.