pub struct RetrievalPolicy {
pub low_budget_ratio: f32,
pub mid_budget_ratio: f32,
}Expand description
Token-budget-aware tier selector for context assembly.
Maps a remaining_ratio (0.0 = budget exhausted, 1.0 = budget fully available) to
the subset of CompressionLevels to include in the context recall step.
§Examples
use zeph_memory::compression::{RetrievalPolicy, CompressionLevel};
let policy = RetrievalPolicy::default();
// Full budget → all three tiers.
let levels = policy.select(0.80);
assert!(levels.contains(&CompressionLevel::Episodic));
assert!(levels.contains(&CompressionLevel::Declarative));
// Low budget → episodic only.
let levels = policy.select(0.10);
assert_eq!(levels, &[CompressionLevel::Episodic]);Fields§
§low_budget_ratio: f32Below this ratio only Episodic recall is attempted. Default: 0.20.
mid_budget_ratio: f32Below this ratio Episodic + Procedural recall is attempted. Default: 0.50.
Implementations§
Source§impl RetrievalPolicy
impl RetrievalPolicy
Sourcepub fn select(&self, remaining_ratio: f32) -> &'static [CompressionLevel]
pub fn select(&self, remaining_ratio: f32) -> &'static [CompressionLevel]
Select which compression levels should be included for remaining_ratio.
remaining_ratio | Levels returned |
|---|---|
< low_budget_ratio | [Episodic] |
< mid_budget_ratio | [Episodic, Procedural] |
≥ mid_budget_ratio | [Episodic, Procedural, Declarative] |
Trait Implementations§
Source§impl Clone for RetrievalPolicy
impl Clone for RetrievalPolicy
Source§fn clone(&self) -> RetrievalPolicy
fn clone(&self) -> RetrievalPolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RetrievalPolicy
impl Debug for RetrievalPolicy
Source§impl Default for RetrievalPolicy
impl Default for RetrievalPolicy
impl Copy for RetrievalPolicy
Auto Trait Implementations§
impl Freeze for RetrievalPolicy
impl RefUnwindSafe for RetrievalPolicy
impl Send for RetrievalPolicy
impl Sync for RetrievalPolicy
impl Unpin for RetrievalPolicy
impl UnsafeUnpin for RetrievalPolicy
impl UnwindSafe for RetrievalPolicy
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 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