Skip to main content

Inference

Trait Inference 

Source
pub trait Inference<S, E: MaybeSend + 'static = ConversationEffect>: Operation<S, E> {
    // Required methods
    fn applies(&self, conversation: &Conversation) -> bool;
    fn infer<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        session: &'life1 S,
        conversation: &'life2 Conversation,
        input: InferenceInput,
        emit: &'life3 Emitter,
    ) -> Pin<Box<dyn Future<Output = Result<OperationResult<E>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;

    // Provided method
    fn prepare_session<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _session: &'life1 S,
    ) -> Pin<Box<dyn Future<Output = Result<Option<S>>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}

Required Methods§

Source

fn applies(&self, conversation: &Conversation) -> bool

Whether the next step would reach the provider. The machine asks before firing the hooks that mark the start of a turn.

Source

fn infer<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, session: &'life1 S, conversation: &'life2 Conversation, input: InferenceInput, emit: &'life3 Emitter, ) -> Pin<Box<dyn Future<Output = Result<OperationResult<E>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Provided Methods§

Source

fn prepare_session<'life0, 'life1, 'async_trait>( &'life0 self, _session: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<Option<S>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§