Skip to main content

IntentClassifier

Trait IntentClassifier 

Source
pub trait IntentClassifier:
    Send
    + Sync
    + Debug {
    // Required method
    fn classify<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
        context: &'life2 [String],
        registry: &'life3 SkillRegistry,
    ) -> Pin<Box<dyn Future<Output = Result<ClassificationResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;

    // Provided method
    fn rebuild_index<'life0, 'life1, 'async_trait>(
        &'life0 self,
        registry: &'life1 SkillRegistry,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Trait for intent classifiers.

Implementations should classify a query and return ranked intent scores.

Required Methods§

Source

fn classify<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, query: &'life1 str, context: &'life2 [String], registry: &'life3 SkillRegistry, ) -> Pin<Box<dyn Future<Output = Result<ClassificationResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Classifies the query and returns ranked intent scores.

§Arguments
  • query - The user’s input query
  • context - Optional conversation context (previous messages)
  • registry - The skill registry to match against
§Returns

A classification result with ranked scores

Provided Methods§

Source

fn rebuild_index<'life0, 'life1, 'async_trait>( &'life0 self, registry: &'life1 SkillRegistry, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Rebuilds any internal indices (e.g., TF-IDF vocabulary). Called when skills are added/removed.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§