MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_embedding_crud

Function test_embedding_crud

atomic-core/src/pristine/txn/write/embeddings.rs:253–268  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

251
252 #[test]
253 fn test_embedding_crud() {
254 let dir = tempdir().unwrap();
255 let pristine = Pristine::open(dir.path().join("db")).unwrap();
256 let mut txn = pristine.write_txn().unwrap();
257 txn.init_embeddings().unwrap();
258
259 let record = make_record(384, 0);
260 txn.put_embedding("memory/arch.md", 0, &record).unwrap();
261
262 let retrieved = txn.get_embedding("memory/arch.md", 0).unwrap().unwrap();
263 assert_eq!(retrieved.vector.len(), 384);
264 assert_eq!(retrieved.preview, "chunk 0");
265
266 assert!(txn.get_embedding("nonexistent", 0).unwrap().is_none());
267 txn.commit().unwrap();
268 }
269
270 #[test]
271 fn test_embedding_list_chunks() {

Callers

nothing calls this directly

Calls 8

make_recordFunction · 0.85
write_txnMethod · 0.80
put_embeddingMethod · 0.80
commitMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45
init_embeddingsMethod · 0.45
get_embeddingMethod · 0.45

Tested by

no test coverage detected