pub struct RecallRequest {Show 15 fields
pub query: Vec<f32>,
pub top_k: usize,
pub memory_types: Option<Vec<MemoryType>>,
pub agent_id: Option<String>,
pub metric: Metric,
pub weights: ScoreWeights,
pub n_probe: Option<usize>,
pub n_rerank: Option<usize>,
pub track_access: bool,
pub filter: Filter,
pub max_bytes: Option<usize>,
pub keywords: Option<String>,
pub keyword_weight: f32,
pub bm25_k1: f32,
pub bm25_b: f32,
}Expand description
A retrieval request for Mnemo::recall.
Fields§
§query: Vec<f32>Query embedding.
top_k: usizeMaximum results to return.
memory_types: Option<Vec<MemoryType>>Restrict to these memory types (None = all types).
agent_id: Option<String>Restrict to a single agent’s view: its own memories plus shared ones.
metric: MetricSimilarity metric.
weights: ScoreWeightsMulti-signal score weights.
n_probe: Option<usize>Index override: partitions to probe (None = index default). Ignored
when no ANN index is present.
n_rerank: Option<usize>Index override: candidates to rerank (None = index default). Ignored
when no ANN index is present.
track_access: boolWhether to update each result’s accessed_at and access_count in
the catalog. Defaults to true, matching pre-v5 behavior.
Set to false for fully read-only recall — useful for batch
scoring, dry-run scoring, or recalls run by introspection tooling
(e.g. mnemo about consumers) where you don’t want the score’s own
observation to perturb the database. With false, recall does not
dirty the catalog and the next flush is a no-op.
filter: FilterPhase 12.6 pre-scoring filter: session_id + AND-ed metadata
conditions applied before the candidate is scored. Default is
Filter::default (no constraints). When the ANN index is on
and this filter is selective enough to starve the shortlist
below top_k, Phase 12.1’s widen-then-exact-scan logic kicks
in so the result still carries up to top_k correct hits.
max_bytes: Option<usize>Phase 12.8 post-scoring budget: stop adding hits once the UTF-8
bytes of their content fields (not the serialized record
body) would exceed this many bytes. None (default) means no
budget and every hit through top_k is returned. If the top-1
hit is already over budget it is still returned — callers that
need an absolute cap should also pre-size top_k.
Counts only the UTF-8 content bytes so the number is stable
across the Rust / Python / CLI / MCP surfaces; the JSON or
MessagePack envelope is excluded. Roughly 4 bytes per BPE
token for English text — a 4 KB budget comfortably holds ~1K
tokens.
Observable through RecallResponse::truncated
(Mnemo::recall_budgeted): true iff at least one scored
hit was dropped by this budget, false otherwise.
keywords: Option<String>FMT-9d (Phase 2, v9 files): identifiers or exact terms to match
(a version, a PR number, a function name) for hybrid recall. Don’t
paste the question: the vector covers its meaning, and its common
words would match the wrong records. BM25 scores, divided by this
query’s best, are added to each candidate’s similarity with weight
RecallRequest::keyword_weight before the usual scoring. With an
empty query vector (RecallRequest::keywords_only), recall is
keyword-only. None (the default) is plain vector recall.
keyword_weight: f32FMT-9d: weight ε of the normalised BM25 score in hybrid recall
(default DEFAULT_KEYWORD_WEIGHT).
bm25_k1: f32FMT-9d: BM25 term-frequency saturation k1 (default 1.2).
bm25_b: f32FMT-9d: BM25 length normalisation b (default 0.75).
Implementations§
Source§impl RecallRequest
impl RecallRequest
Sourcepub fn keywords_only(keywords: impl Into<String>) -> Self
pub fn keywords_only(keywords: impl Into<String>) -> Self
FMT-9d (v9 files): a keyword-only request: BM25 over keywords
(identifiers or exact terms), no query vector, so it works without
an embedder.
Sourcepub fn keywords(self, text: impl Into<String>) -> Self
pub fn keywords(self, text: impl Into<String>) -> Self
FMT-9d (v9 files): add identifiers or exact terms to match (hybrid
recall). Pass identifiers, not the question. See the keywords
field.
Sourcepub fn keyword_weight(self, w: f32) -> Self
pub fn keyword_weight(self, w: f32) -> Self
FMT-9d: the weight ε of the keyword score in hybrid recall.
Sourcepub fn filter(self, filter: Filter) -> Self
pub fn filter(self, filter: Filter) -> Self
Phase 12.6: attach a pre-scoring filter. See Filter and
FilterTerm for term shapes.
Sourcepub fn max_bytes(self, n: usize) -> Self
pub fn max_bytes(self, n: usize) -> Self
Phase 12.8: cap the total UTF-8 bytes of returned content
fields. See RecallRequest::max_bytes.
Sourcepub fn from_text(embedder: &dyn Embedder, query_text: &str) -> Result<Self>
pub fn from_text(embedder: &dyn Embedder, query_text: &str) -> Result<Self>
Build a request by embedding query_text with the supplied
embedder (Phase 3). Shorthand for embedder.embed(&[text]) +
RecallRequest::new; same defaults as new. Fails if the
embedder returns an empty vector list or an embedding failure.
Sourcepub fn types(self, t: Vec<MemoryType>) -> Self
pub fn types(self, t: Vec<MemoryType>) -> Self
Restrict to specific memory types.
Sourcepub fn weights(self, weights: ScoreWeights) -> Self
pub fn weights(self, weights: ScoreWeights) -> Self
Replace the multi-signal score weights.
Sourcepub fn n_probe(self, n: usize) -> Self
pub fn n_probe(self, n: usize) -> Self
Override the number of IVF partitions probed (accuracy/speed dial).
Sourcepub fn n_rerank(self, n: usize) -> Self
pub fn n_rerank(self, n: usize) -> Self
Override the number of candidates reranked exactly (accuracy dial).
Sourcepub fn track_access(self, track: bool) -> Self
pub fn track_access(self, track: bool) -> Self
Toggle whether recall updates accessed_at / access_count on
the returned memories’ catalog entries (default true). Pass
false for a fully read-only recall — see the field doc.