RetrieveMemoryRequest
Rust struct goodmem::models::RetrieveMemoryRequest: declaration, fields or variants, and implementations.
Struct RetrieveMemoryRequest
goodmem::models::RetrieveMemoryRequest
Request body for semantic memory retrieval with optional embedder weight overrides.
pub struct RetrieveMemoryRequest {
pub message: String,
pub context: Option<Vec<ContextItem>>,
pub space_keys: Vec<SpaceKey>,
pub requested_size: Option<i32>,
pub output_budget: Option<Box<TokenBudget>>,
pub fetch_memory: Option<bool>,
pub fetch_memory_content: Option<bool>,
pub hnsw: Option<Box<HnswOptions>>,
pub post_processor: Option<Box<PostProcessor>>,
pub logging: Option<Box<LoggingOptions>>,
pub query_instruction: Option<String>,
pub embedder_query_formats: Option<Vec<EmbedderQueryFormat>>,
}Referenced types: ContextItem, EmbedderQueryFormat, HnswOptions, LoggingOptions, PostProcessor, SpaceKey, TokenBudget.
Fields
message
pub message: String
Primary query/message for semantic search.
Wire name: message.
context
pub context: Option<Vec<ContextItem>>
Optional context items (text or binary) to provide additional context for the search.
Wire name: context.
space_keys
pub space_keys: Vec<SpaceKey>
List of spaces to search with optional per-embedder weight overrides.
Wire name: spaceKeys.
requested_size
pub requested_size: Option<i32>
Maximum number of memories to retrieve. Zero or omitted uses 20; negative values are invalid.
Wire name: requestedSize.
output_budget
pub output_budget: Option<Box<TokenBudget>>
Optional soft cap for generated retrieve replies. When set to a positive token count, chat post-processing uses this value as the LLM completion-token budget.
Wire name: outputBudget.
fetch_memory
pub fetch_memory: Option<bool>
Whether to include streamed memory-definition records in the response. Defaults to true when omitted. These records include memory metadata and audit fields, but omit originalContent unless fetchMemoryContent is true.
Wire name: fetchMemory.
fetch_memory_content
pub fetch_memory_content: Option<bool>
Whether streamed memory-definition records include originalContent bytes. Requires fetchMemory=true. Defaults to false when omitted.
Wire name: fetchMemoryContent.
hnsw
pub hnsw: Option<Box<HnswOptions>>
Optional request-level HNSW tuning overrides. Advanced usage; available on POST retrieve.
Wire name: hnsw.
post_processor
pub post_processor: Option<Box<PostProcessor>>
Optional post-processor configuration to transform retrieval results.
Wire name: postProcessor.
logging
pub logging: Option<Box<LoggingOptions>>
Optional durable request logging block for POST retrieve requests. Set logging.enabled=true to opt in, or supply flat scalar logging.callerAttributes to attach if caller opt-in or an admin policy logs the request.
Wire name: logging.
query_instruction
pub query_instruction: Option<String>
Optional task instruction for this request. It applies to query embedding only. Every embedder whose query template reads {{ instruction }} uses it in place of its stored instruction; embedders whose template does not read it ignore it. It never reaches a reranker. A blank value counts as not set.
Wire name: queryInstruction.
embedder_query_formats
pub embedder_query_formats: Option<Vec<EmbedderQueryFormat>>
Optional per-embedder overrides of the stored query format for this request, at most one entry per embedder. An entry's instruction, including an empty one that removes it, takes precedence over the request-wide query instruction for that embedder. Every entry is checked before any embedding call.
Wire name: embedderQueryFormats.
Implementations
validate
pub fn validate(&self) -> crate::Result<()>
Validate the request before sending, without making an HTTP call.
new
pub fn new(message: impl Into<String>, space_ids: impl IntoIterator<Item = String>) -> Self
Build a query over spaces; filters, weights, context, and postprocessing remain editable.
Trait implementations
Clone(derived)Default(derived)PartialEq(derived)Serialize(derived)impl<'de> Deserialize<'de> for RetrieveMemoryRequestimpl std::fmt::Debug for RetrieveMemoryRequest