MCPcopy Index your code
hub / github.com/InfinitiBit/graphbit / update

Method update

core/src/memory/vector.rs:80–90  ·  view source on GitHub ↗

Replace the embedding for an existing memory.

(&self, memory_id: &MemoryId, embedding: Vec<f32>)

Source from the content-addressed store, hash-verified

78
79 /// Replace the embedding for an existing memory.
80 pub async fn update(&self, memory_id: &MemoryId, embedding: Vec<f32>) {
81 let mut entries = self.entries.write().await;
82 if let Some(entry) = entries.iter_mut().find(|e| &e.memory_id == memory_id) {
83 entry.embedding = embedding;
84 } else {
85 entries.push(VectorEntry {
86 memory_id: memory_id.clone(),
87 embedding,
88 });
89 }
90 }
91
92 /// Remove all entries from the index.
93 pub async fn clear(&self) {

Callers 1

test_vector_index_updateFunction · 0.45

Calls 1

cloneMethod · 0.80

Tested by 1

test_vector_index_updateFunction · 0.36