TurnExtractor

Trait TurnExtractor 

Source
pub trait TurnExtractor: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn window_size(&self) -> usize;
    fn extract<'life0, 'life1, 'async_trait>(
        &'life0 self,
        window: &'life1 [TranscriptTurn],
    ) -> Pin<Box<dyn Future<Output = Result<Value, LlmError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn should_extract(&self, window: &[TranscriptTurn]) -> bool { ... }
    fn trigger(&self) -> ExtractionTrigger { ... }
    fn promotion_rules(&self) -> &[FieldPromotion] { ... }
}
Expand description

Trait for between-turn extraction from transcript windows.

Implementations receive a window of recent transcript turns and produce a structured JSON value. The processor stores the result in State under the extractor’s name.

Required Methods§

Source

fn name(&self) -> &str

Name of this extractor (used as the State key).

Source

fn window_size(&self) -> usize

How many recent turns this extractor needs.

Source

fn extract<'life0, 'life1, 'async_trait>( &'life0 self, window: &'life1 [TranscriptTurn], ) -> Pin<Box<dyn Future<Output = Result<Value, LlmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Extract structured data from the transcript window.

Provided Methods§

Source

fn should_extract(&self, window: &[TranscriptTurn]) -> bool

Whether this extractor should run for the current turn.

Override to skip extraction on trivial turns (e.g., short utterances, turns without user speech). Default returns true (always extract).

This is checked before launching the async extraction, so returning false avoids an LLM round-trip entirely.

Source

fn trigger(&self) -> ExtractionTrigger

The trigger mode for this extractor.

Controls when the extractor runs. Default is EveryTurn.

Source

fn promotion_rules(&self) -> &[FieldPromotion]

Field promotion rules for this extractor.

When empty, the runtime preserves legacy behavior and auto-flattens top-level non-null fields into state. When non-empty, only these rules can promote raw extraction fields into authoritative state.

Implementors§