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§
Sourcefn window_size(&self) -> usize
fn window_size(&self) -> usize
How many recent turns this extractor needs.
Provided Methods§
Sourcefn should_extract(&self, window: &[TranscriptTurn]) -> bool
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.
Sourcefn trigger(&self) -> ExtractionTrigger
fn trigger(&self) -> ExtractionTrigger
The trigger mode for this extractor.
Controls when the extractor runs. Default is EveryTurn.
Sourcefn promotion_rules(&self) -> &[FieldPromotion]
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.