pub struct Reasoner { /* private fields */ }Implementations§
Source§impl Reasoner
impl Reasoner
pub fn new(cache_size: Option<usize>) -> Self
pub async fn process_thought( &self, request: ReasoningRequest, ) -> ReasoningResponse
pub async fn get_best_reasoning_path( &self, strategy_type: Option<&str>, ) -> Vec<ThoughtNode>
pub async fn get_stats(&self, strategy_types: Vec<&str>) -> ReasoningStats
Sourcepub fn get_cache_stats(&self) -> EmbeddingCacheSnapshot
pub fn get_cache_stats(&self) -> EmbeddingCacheSnapshot
Get embedding cache statistics from BaseStrategy
This is an enhancement over the reference TypeScript implementation, providing observability into the local Stella 400M embedding cache performance.
Returns cache hit rate, memory usage, and eviction counts for performance monitoring and capacity planning.
Sourcepub async fn clear(&self)
pub async fn clear(&self)
Clears all reasoning state.
§Behavior
This method clears the shared StateManager, which stores:
- All thought nodes and their relationships
- Path histories and scores
- Global reasoning state
§Strategy State Lifetime
Strategy-specific state (beams, MCTS trees, policy metrics, caches) is not cleared by this method because:
- Each
process_thought()call creates a fresh strategy instance - Strategy state is captured by spawned async tasks
- Old strategy instances are garbage collected when tasks complete
- There are no shared strategy instances to clear
This design ensures:
- Clean separation between persistent state (StateManager) and compute (Strategies)
- Automatic cleanup via Rust’s ownership system
- No risk of clearing active in-flight strategy operations
§Examples
ⓘ
let reasoner = Reasoner::new(Some(1000));
// Process 100 thoughts
for i in 0..100 {
reasoner.process_thought(request).await;
}
// Clear all reasoning state
reasoner.clear().await;
// StateManager is now empty
// Old strategy instances will be GC'd when async tasks finishAuto Trait Implementations§
impl Freeze for Reasoner
impl NotResult for Reasoner
impl !NotString for Reasoner
impl !RefUnwindSafe for Reasoner
impl Send for Reasoner
impl Sync for Reasoner
impl Unpin for Reasoner
impl !UnwindSafe for Reasoner
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> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request