Skip to main content

IntoFilter

Trait IntoFilter 

Source
pub trait IntoFilter:
    MemoryPolicy
    + Sized
    + 'static {
    // Provided method
    fn into_filter(
        self,
    ) -> Box<dyn Fn(Vec<Message>) -> Vec<Message> + Send + Sync> { ... }
}
Expand description

Adapt a MemoryPolicy into a closure suitable for InMemoryConversationMemory::with_filter.

Errors raised by the policy are swallowed because with_filter does not propagate failures. Use MemoryPolicy::apply directly when you need to observe policy errors.

Provided Methods§

Source

fn into_filter(self) -> Box<dyn Fn(Vec<Message>) -> Vec<Message> + Send + Sync>

Convert this policy into a filter closure.

On policy error the original input is returned unchanged and a tracing::warn! is emitted, so a transient policy bug degrades gracefully (the model still sees the unfiltered history) instead of silently erasing context.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<P> IntoFilter for P
where P: MemoryPolicy + 'static,