Skip to main content

Transcript

Struct Transcript 

Source
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: Role

Who produced this text — Role::User (STT) or Role::Agent (LM).

§finality: Finality

Whether this is an in-progress Finality::Partial or the completed Finality::Final unit.

Implementations§

Source§

impl Transcript

Source

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.

Source

pub fn user_final(text: impl Into<Arc<str>>) -> Self

A completed user utterance.

Source

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()).

Source

pub fn agent_final(text: impl Into<Arc<str>>) -> Self

A completed agent generation.

Trait Implementations§

Source§

impl Clone for Transcript

Source§

fn clone(&self) -> Transcript

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Transcript

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Transcript> for DataFrame

Source§

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.

Source§

impl PartialEq for Transcript

Source§

fn eq(&self, other: &Transcript) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Transcript

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.