pub struct RetrievalConfig {
pub depth: u32,
pub search_prompt_template: String,
pub context_format: ContextFormat,
pub query_bias_correction: bool,
pub query_bias_profile_weight: f32,
pub query_bias_centroid_ttl_secs: u64,
}Expand description
Retrieval-stage tuning for semantic memory (MemMachine-inspired, #3340).
Controls ANN candidate depth, search-prompt template, and memory snippet rendering.
Nested under [memory.retrieval] in TOML. All fields have defaults so existing
configs parse unchanged.
§Example (TOML)
[memory.retrieval]
# depth = 0 # 0 = legacy (recall_limit * 2); set ≥ 1 to override directly
# search_prompt_template = ""
# context_format = "structured"Fields§
§depth: u32Number of ANN candidates fetched from the vector store before keyword merge, temporal decay, and MMR re-ranking.
0(default): legacy behavior —recall_limit * 2candidates, byte-identical to pre-#3340 deployments.≥ 1: the configured value is passed directly toqdrant.search/keyword_search. Set to at leastrecall_limit * 2to match the legacy pool size, or higher for better MMR diversity.
A value below recall_limit triggers a one-shot WARN because the ANN pool
cannot saturate the requested top-k.
search_prompt_template: StringTemplate applied to the raw user query before embedding.
Supports a single {query} placeholder which is replaced with the raw query string.
Empty string (default) = identity: the query is embedded as-is.
Applied only at query-side embedding sites — stored content (summaries, documents)
is never wrapped. Use this for asymmetric embedding models (e.g. E5 "query: {query}").
context_format: ContextFormatShape of memory snippets injected into agent context.
See ContextFormat for the exact rendering and token-cost implications.
Default: Structured.
query_bias_correction: boolEnable query-bias correction towards the user’s profile centroid (MM-F3, #3341).
When true and the query is classified as first-person, the query embedding is
shifted towards the centroid of persona-fact embeddings. This nudges recall results
towards persona-relevant content for self-referential queries.
Default: true (low blast-radius: no-op when the persona table is empty).
query_bias_profile_weight: f32Blend weight for query-bias correction (MM-F3, #3341).
Controls how much the query embedding shifts towards the profile centroid.
0.0 = no shift; 1.0 = full centroid. Clamped to [0.0, 1.0]. Default: 0.25.
query_bias_centroid_ttl_secs: u64Centroid TTL in seconds (MM-F3, #3341).
The profile centroid computed from persona facts is cached for this many seconds. After expiry it is recomputed on the next first-person query. Default: 300 (5 min).
Trait Implementations§
Source§impl Clone for RetrievalConfig
impl Clone for RetrievalConfig
Source§fn clone(&self) -> RetrievalConfig
fn clone(&self) -> RetrievalConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RetrievalConfig
impl Debug for RetrievalConfig
Source§impl Default for RetrievalConfig
impl Default for RetrievalConfig
Source§fn default() -> RetrievalConfig
fn default() -> RetrievalConfig
Source§impl<'de> Deserialize<'de> for RetrievalConfigwhere
RetrievalConfig: Default,
impl<'de> Deserialize<'de> for RetrievalConfigwhere
RetrievalConfig: Default,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<RetrievalConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RetrievalConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for RetrievalConfig
impl Serialize for RetrievalConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for RetrievalConfig
impl RefUnwindSafe for RetrievalConfig
impl Send for RetrievalConfig
impl Sync for RetrievalConfig
impl Unpin for RetrievalConfig
impl UnsafeUnpin for RetrievalConfig
impl UnwindSafe for RetrievalConfig
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
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>
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>
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>
T in a tonic::Request