pub struct MemoryRecordBuilder { /* private fields */ }Expand description
Builder type used to assemble MemoryRecord instances safely.
Implementations§
Source§impl MemoryRecordBuilder
impl MemoryRecordBuilder
Sourcepub fn timestamp(self, timestamp: SystemTime) -> Self
pub fn timestamp(self, timestamp: SystemTime) -> Self
Sets the timestamp for the record.
Sourcepub fn tag(self, tag: impl Into<String>) -> MemoryResult<Self>
pub fn tag(self, tag: impl Into<String>) -> MemoryResult<Self>
Adds a single tag after validating that it is not empty.
§Errors
Returns MemoryError::InvalidRecord when the tag is empty or whitespace.
Extends the record with multiple tags.
§Errors
Returns MemoryError::InvalidRecord if any supplied tag is empty.
Sourcepub fn merge_metadata(self, map: Map<String, Value>) -> Self
pub fn merge_metadata(self, map: Map<String, Value>) -> Self
Adds a full metadata map, overwriting existing keys when duplicates occur.
Sourcepub fn embedding(self, embedding: EmbeddingVector) -> Self
pub fn embedding(self, embedding: EmbeddingVector) -> Self
Attaches an embedding to the record.
Sourcepub fn build(self) -> MemoryResult<MemoryRecord>
pub fn build(self) -> MemoryResult<MemoryRecord>
Finalises the builder and produces the record.
§Errors
Returns MemoryError when the builder state fails validation.