Introduce signals change (#655)

* adding support for signals

* reducing false positives for signals like positive interaction

* adding docs. Still need to fix the messages list, but waiting on PR #621

* Improve frustration detection: normalize contractions and refine punctuation

* Further refine test cases with longer messages

* minor doc changes

* fixing echo statement for build

* fixing the messages construction and using the trait for signals

* update signals docs

* fixed some minor doc changes

* added more tests and fixed docuemtnation. PR 100% ready

* made fixes based on PR comments

* Optimize latency

1. replace sliding window approach with trigram containment check
2. add code to pre-compute ngrams for patterns

* removed some debug statements to make tests easier to read

* PR comments to make ObservableStreamProcessor accept optonal Vec<Messagges>

* fixed PR comments

---------

Co-authored-by: Salman Paracha <salmanparacha@MacBook-Pro-342.local>
Co-authored-by: MeiyuZhong <mariazhong9612@gmail.com>
Co-authored-by: nehcgs <54548843+nehcgs@users.noreply.github.com>
This commit is contained in:
Salman Paracha 2026-01-07 11:20:44 -08:00 committed by GitHub
parent 57327ba667
commit b4543ba56c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 3972 additions and 191 deletions

View file

@ -139,6 +139,45 @@ pub mod error {
pub const STACK_TRACE: &str = "error.stack_trace";
}
// =============================================================================
// Span Attributes - Agentic Signals
// =============================================================================
/// Behavioral quality indicators for agent interactions
/// These signals are computed automatically from conversation patterns
pub mod signals {
/// Overall quality assessment
/// Values: "Excellent", "Good", "Neutral", "Poor", "Severe"
pub const QUALITY: &str = "signals.quality";
/// Total number of turns in the conversation
pub const TURN_COUNT: &str = "signals.turn_count";
/// Efficiency score (0.0-1.0)
pub const EFFICIENCY_SCORE: &str = "signals.efficiency_score";
/// Number of repair attempts detected
pub const REPAIR_COUNT: &str = "signals.follow_up.repair.count";
/// Ratio of repairs to user turns
pub const REPAIR_RATIO: &str = "signals.follow_up.repair.ratio";
/// Number of frustration indicators detected
pub const FRUSTRATION_COUNT: &str = "signals.frustration.count";
/// Frustration severity level (0-3)
pub const FRUSTRATION_SEVERITY: &str = "signals.frustration.severity";
/// Number of repetition instances detected
pub const REPETITION_COUNT: &str = "signals.repetition.count";
/// Whether escalation was requested (user asked for human help)
pub const ESCALATION_REQUESTED: &str = "signals.escalation.requested";
/// Number of positive feedback indicators detected
pub const POSITIVE_FEEDBACK_COUNT: &str = "signals.positive_feedback.count";
}
// =============================================================================
// Operation Names
// =============================================================================

View file

@ -1,3 +1,5 @@
mod constants;
pub use constants::{error, http, llm, operation_component, routing, OperationNameBuilder};
pub use constants::{
error, http, llm, operation_component, routing, signals, OperationNameBuilder,
};