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 more