pub struct EventClassifier { /* private fields */ }Expand description
Maps decoded daemon events into deliverable, streaming, or failed outcomes.
Implementations§
Source§impl EventClassifier
impl EventClassifier
Sourcepub fn new(cfg: ClassifierConfig) -> Result<Self, ClassifierConfigError>
pub fn new(cfg: ClassifierConfig) -> Result<Self, ClassifierConfigError>
Construct a classifier from config.
Returns an error when deliverable_phases is empty (required product decision).
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Classifier with default deliverable phases from DEFAULT_DELIVERABLE_PHASES.
Sourcepub fn classify(&self, msg: &Value, accumulated: &str) -> ChatEventResult
pub fn classify(&self, msg: &Value, accumulated: &str) -> ChatEventResult
Classify one decoded event. Prefer Self::classify_turn when stream-end or
gated idle completion needs a per-turn TurnLifecycleGate.
Sourcepub fn classify_turn(
&self,
msg: &Value,
accumulated: &str,
gate: Option<&mut TurnLifecycleGate>,
) -> ChatEventResult
pub fn classify_turn( &self, msg: &Value, accumulated: &str, gate: Option<&mut TurnLifecycleGate>, ) -> ChatEventResult
Classify one event and optionally observe a per-turn lifecycle gate first.
Sourcepub fn is_deliverable_completion_event(&self, event_type: &str) -> bool
pub fn is_deliverable_completion_event(&self, event_type: &str) -> bool
Report whether a persisted completion_event is user-facing.
Sourcepub fn is_substantive_assistant_reply(&self, content: &str) -> bool
pub fn is_substantive_assistant_reply(&self, content: &str) -> bool
Report whether trimmed assistant text is long enough to persist as final.
Sourcepub fn resolve_deliverable_final_content(
&self,
event_result: &ChatEventResult,
accumulated: &str,
) -> Option<String>
pub fn resolve_deliverable_final_content( &self, event_result: &ChatEventResult, accumulated: &str, ) -> Option<String>
Pick the user-visible reply for a completed query.
Falls back to accumulated streamed text when the deliverable event has empty content (common after StrangeLoop streamed the answer on non-deliverable phases).
Trait Implementations§
Source§impl Clone for EventClassifier
impl Clone for EventClassifier
Source§fn clone(&self) -> EventClassifier
fn clone(&self) -> EventClassifier
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more