pub struct LazyStrategy { /* private fields */ }Expand description
Lazy summary strategy - generates summaries on-demand.
Summaries are generated when first requested and optionally cached for future use.
Implementations§
Source§impl LazyStrategy
impl LazyStrategy
Sourcepub fn with_persist(client: LlmClient, persist: bool) -> Self
pub fn with_persist(client: LlmClient, persist: bool) -> Self
Create with persistence enabled.
Sourcepub fn with_generator(generator: Box<dyn SummaryGenerator>) -> Self
pub fn with_generator(generator: Box<dyn SummaryGenerator>) -> Self
Create with custom generator.
Sourcepub fn with_persist_mode(self, persist: bool) -> Self
pub fn with_persist_mode(self, persist: bool) -> Self
Set persistence mode.
Sourcepub fn with_config(self, config: SummaryStrategyConfig) -> Self
pub fn with_config(self, config: SummaryStrategyConfig) -> Self
Set configuration.
Sourcepub async fn has_cached(&self, node_id: &str) -> bool
pub async fn has_cached(&self, node_id: &str) -> bool
Check if a cached summary exists.
Sourcepub async fn get_cached(&self, node_id: &str) -> Option<String>
pub async fn get_cached(&self, node_id: &str) -> Option<String>
Get a cached summary if available.
Sourcepub async fn get_or_generate(
&self,
node_id: &str,
title: &str,
content: &str,
) -> LlmResult<String>
pub async fn get_or_generate( &self, node_id: &str, title: &str, content: &str, ) -> LlmResult<String>
Get or generate a summary.
Returns the cached summary if available, otherwise generates a new one.
Sourcepub async fn populate_cache(&self, summaries: HashMap<String, String>)
pub async fn populate_cache(&self, summaries: HashMap<String, String>)
Pre-populate the cache with existing summaries.
Sourcepub async fn clear_cache(&self)
pub async fn clear_cache(&self)
Clear the cache.
Sourcepub async fn cache_size(&self) -> usize
pub async fn cache_size(&self) -> usize
Get cache size.
Sourcepub fn is_persist_enabled(&self) -> bool
pub fn is_persist_enabled(&self) -> bool
Check if persistence is enabled.
Sourcepub fn config(&self) -> &SummaryStrategyConfig
pub fn config(&self) -> &SummaryStrategyConfig
Get the configuration.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LazyStrategy
impl !RefUnwindSafe for LazyStrategy
impl Send for LazyStrategy
impl Sync for LazyStrategy
impl Unpin for LazyStrategy
impl UnsafeUnpin for LazyStrategy
impl !UnwindSafe for LazyStrategy
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 more