pub enum Pattern {
ToolSequence {
id: PatternId,
tools: Vec<String>,
context: TaskContext,
success_rate: f32,
avg_latency: Duration,
occurrence_count: usize,
effectiveness: PatternEffectiveness,
},
DecisionPoint {
id: PatternId,
condition: String,
action: String,
outcome_stats: OutcomeStats,
context: TaskContext,
effectiveness: PatternEffectiveness,
},
ErrorRecovery {
id: PatternId,
error_type: String,
recovery_steps: Vec<String>,
success_rate: f32,
context: TaskContext,
effectiveness: PatternEffectiveness,
},
ContextPattern {
id: PatternId,
context_features: Vec<String>,
recommended_approach: String,
evidence: Vec<Uuid>,
success_rate: f32,
effectiveness: PatternEffectiveness,
},
}Expand description
Pattern types extracted from episodes
Variants§
ToolSequence
Sequence of tools used successfully
DecisionPoint
Decision point with outcome statistics
ErrorRecovery
Error recovery pattern
ContextPattern
Context-based pattern
Implementations§
Source§impl Pattern
impl Pattern
Sourcepub fn success_rate(&self) -> f32
pub fn success_rate(&self) -> f32
Get the success rate of this pattern
Sourcepub fn context(&self) -> Option<&TaskContext>
pub fn context(&self) -> Option<&TaskContext>
Get the context associated with this pattern
Sourcepub fn sample_size(&self) -> usize
pub fn sample_size(&self) -> usize
Get the sample size (number of occurrences) for this pattern
Sourcepub fn effectiveness(&self) -> &PatternEffectiveness
pub fn effectiveness(&self) -> &PatternEffectiveness
Get the effectiveness tracking data for this pattern
Sourcepub fn effectiveness_mut(&mut self) -> &mut PatternEffectiveness
pub fn effectiveness_mut(&mut self) -> &mut PatternEffectiveness
Get mutable access to effectiveness tracking data
Sourcepub fn record_retrieval(&mut self)
pub fn record_retrieval(&mut self)
Record that this pattern was retrieved in a query
Sourcepub fn record_application(&mut self, success: bool, reward_delta: f32)
pub fn record_application(&mut self, success: bool, reward_delta: f32)
Record that this pattern was applied with an outcome
Source§impl Pattern
impl Pattern
Sourcepub fn is_relevant_to(&self, query_context: &TaskContext) -> bool
pub fn is_relevant_to(&self, query_context: &TaskContext) -> bool
Check if this pattern is relevant to a given context
Sourcepub fn similarity_key(&self) -> String
pub fn similarity_key(&self) -> String
Get a similarity key for pattern deduplication Patterns with identical keys are considered duplicates
Sourcepub fn similarity_score(&self, other: &Self) -> f32
pub fn similarity_score(&self, other: &Self) -> f32
Calculate similarity score between this pattern and another (0.0 to 1.0) Uses edit distance for sequences and context matching
Sourcepub fn confidence(&self) -> f32
pub fn confidence(&self) -> f32
Calculate confidence score for this pattern
Confidence = success_rate * sqrt(sample_size)
Sourcepub fn merge_with(&mut self, other: &Self)
pub fn merge_with(&mut self, other: &Self)
Merge this pattern with another similar pattern Combines evidence and updates statistics
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Pattern
impl<'de> Deserialize<'de> for Pattern
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Pattern
Auto Trait Implementations§
impl Freeze for Pattern
impl RefUnwindSafe for Pattern
impl Send for Pattern
impl Sync for Pattern
impl Unpin for Pattern
impl UnsafeUnpin for Pattern
impl UnwindSafe for Pattern
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.