tribalmemory 0.1.1__py3-none-any.whl → 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tribalmemory/cli.py +147 -4
- tribalmemory/interfaces.py +66 -3
- tribalmemory/mcp/server.py +272 -14
- tribalmemory/server/app.py +53 -2
- tribalmemory/server/config.py +41 -0
- tribalmemory/server/models.py +65 -0
- tribalmemory/server/routes.py +68 -0
- tribalmemory/services/fts_store.py +255 -0
- tribalmemory/services/graph_store.py +627 -0
- tribalmemory/services/memory.py +471 -37
- tribalmemory/services/reranker.py +267 -0
- tribalmemory/services/session_store.py +412 -0
- tribalmemory/services/vector_store.py +86 -1
- {tribalmemory-0.1.1.dist-info → tribalmemory-0.3.0.dist-info}/METADATA +1 -1
- {tribalmemory-0.1.1.dist-info → tribalmemory-0.3.0.dist-info}/RECORD +19 -15
- {tribalmemory-0.1.1.dist-info → tribalmemory-0.3.0.dist-info}/WHEEL +0 -0
- {tribalmemory-0.1.1.dist-info → tribalmemory-0.3.0.dist-info}/entry_points.txt +0 -0
- {tribalmemory-0.1.1.dist-info → tribalmemory-0.3.0.dist-info}/licenses/LICENSE +0 -0
- {tribalmemory-0.1.1.dist-info → tribalmemory-0.3.0.dist-info}/top_level.txt +0 -0
|
@@ -252,7 +252,63 @@ class LanceDBVectorStore(IVectorStore):
|
|
|
252
252
|
async def count(self, filters: Optional[dict] = None) -> int:
|
|
253
253
|
entries = await self.list(limit=100000, filters=filters)
|
|
254
254
|
return len(entries)
|
|
255
|
-
|
|
255
|
+
|
|
256
|
+
async def get_stats(self) -> dict:
|
|
257
|
+
"""Compute stats natively over LanceDB rows.
|
|
258
|
+
|
|
259
|
+
Iterates rows in pages to avoid loading all embeddings into
|
|
260
|
+
RAM. Only the metadata columns are read.
|
|
261
|
+
"""
|
|
262
|
+
await self._ensure_initialized()
|
|
263
|
+
|
|
264
|
+
by_source: dict[str, int] = {}
|
|
265
|
+
by_instance: dict[str, int] = {}
|
|
266
|
+
by_tag: dict[str, int] = {}
|
|
267
|
+
total = 0
|
|
268
|
+
corrections = 0
|
|
269
|
+
|
|
270
|
+
page_size = 1000
|
|
271
|
+
offset = 0
|
|
272
|
+
while True:
|
|
273
|
+
rows = (
|
|
274
|
+
self._table.search()
|
|
275
|
+
.where("deleted = false")
|
|
276
|
+
.select(["source_type", "source_instance", "tags",
|
|
277
|
+
"supersedes"])
|
|
278
|
+
.limit(page_size + offset)
|
|
279
|
+
.to_list()
|
|
280
|
+
)
|
|
281
|
+
page = rows[offset:]
|
|
282
|
+
if not page:
|
|
283
|
+
break
|
|
284
|
+
|
|
285
|
+
for row in page:
|
|
286
|
+
total += 1
|
|
287
|
+
src = row.get("source_type", "unknown")
|
|
288
|
+
by_source[src] = by_source.get(src, 0) + 1
|
|
289
|
+
|
|
290
|
+
inst = row.get("source_instance", "unknown")
|
|
291
|
+
by_instance[inst] = by_instance.get(inst, 0) + 1
|
|
292
|
+
|
|
293
|
+
tags = json.loads(row.get("tags", "[]"))
|
|
294
|
+
for tag in tags:
|
|
295
|
+
by_tag[tag] = by_tag.get(tag, 0) + 1
|
|
296
|
+
|
|
297
|
+
if row.get("supersedes"):
|
|
298
|
+
corrections += 1
|
|
299
|
+
|
|
300
|
+
if len(page) < page_size:
|
|
301
|
+
break
|
|
302
|
+
offset += page_size
|
|
303
|
+
|
|
304
|
+
return {
|
|
305
|
+
"total_memories": total,
|
|
306
|
+
"by_source_type": by_source,
|
|
307
|
+
"by_tag": by_tag,
|
|
308
|
+
"by_instance": by_instance,
|
|
309
|
+
"corrections": corrections,
|
|
310
|
+
}
|
|
311
|
+
|
|
256
312
|
def _row_to_entry(self, row: dict) -> MemoryEntry:
|
|
257
313
|
return MemoryEntry(
|
|
258
314
|
id=row["id"],
|
|
@@ -358,3 +414,32 @@ class InMemoryVectorStore(IVectorStore):
|
|
|
358
414
|
async def count(self, filters: Optional[dict] = None) -> int:
|
|
359
415
|
entries = await self.list(limit=100000, filters=filters)
|
|
360
416
|
return len(entries)
|
|
417
|
+
|
|
418
|
+
async def get_stats(self) -> dict:
|
|
419
|
+
"""Compute stats in a single pass over in-memory entries."""
|
|
420
|
+
by_source: dict[str, int] = {}
|
|
421
|
+
by_instance: dict[str, int] = {}
|
|
422
|
+
by_tag: dict[str, int] = {}
|
|
423
|
+
total = 0
|
|
424
|
+
corrections = 0
|
|
425
|
+
|
|
426
|
+
for entry in self._store.values():
|
|
427
|
+
if entry.id in self._deleted:
|
|
428
|
+
continue
|
|
429
|
+
total += 1
|
|
430
|
+
src = entry.source_type.value
|
|
431
|
+
by_source[src] = by_source.get(src, 0) + 1
|
|
432
|
+
inst = entry.source_instance
|
|
433
|
+
by_instance[inst] = by_instance.get(inst, 0) + 1
|
|
434
|
+
for tag in entry.tags:
|
|
435
|
+
by_tag[tag] = by_tag.get(tag, 0) + 1
|
|
436
|
+
if entry.supersedes:
|
|
437
|
+
corrections += 1
|
|
438
|
+
|
|
439
|
+
return {
|
|
440
|
+
"total_memories": total,
|
|
441
|
+
"by_source_type": by_source,
|
|
442
|
+
"by_tag": by_tag,
|
|
443
|
+
"by_instance": by_instance,
|
|
444
|
+
"corrections": corrections,
|
|
445
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
tribalmemory/__init__.py,sha256=DNgC_ZT0lrhxsPdhXu4oeG_UdrLstYQHeKwR-U2toeY,104
|
|
2
|
-
tribalmemory/cli.py,sha256=
|
|
3
|
-
tribalmemory/interfaces.py,sha256=
|
|
2
|
+
tribalmemory/cli.py,sha256=wbVsgMst4NEuWkwA2dily_qC8AP6jvAHKwHgE3B-TG8,15960
|
|
3
|
+
tribalmemory/interfaces.py,sha256=hs32jxImd3AXa0EfysGhP-goDAMQ90fqVQV4PbTpgQQ,12287
|
|
4
4
|
tribalmemory/utils.py,sha256=aei7xR6OVMGkllPySA2boeHyI3D1JsHTUX1YeaZdkMY,696
|
|
5
5
|
tribalmemory/a21/__init__.py,sha256=u1793uKzbWGKwiAVmCxEO9_3rdTL7QKTLhQQB8Umsl4,1181
|
|
6
6
|
tribalmemory/a21/system.py,sha256=gGFVWBTckSTFv8ZciEUc05HYjwxZP22UpIqbxXD6giM,9185
|
|
@@ -19,7 +19,7 @@ tribalmemory/a21/providers/openai.py,sha256=MxFJXph8rVFAqkVMCS3vxdqwBB8_MhoqqGg6
|
|
|
19
19
|
tribalmemory/a21/providers/timestamp.py,sha256=T1sJkaQSixRip2C0AUPnljWP0u5w4iHoIcVRmG8FgPo,2994
|
|
20
20
|
tribalmemory/mcp/__init__.py,sha256=r7CzTwzAnSgox8_cBNZgtXDjMGxC7o8polptSvB-AvY,262
|
|
21
21
|
tribalmemory/mcp/__main__.py,sha256=GX6mNmM_Lpq4EyuTr__awVTf1btCi7TpEkNtMTkgas0,115
|
|
22
|
-
tribalmemory/mcp/server.py,sha256=
|
|
22
|
+
tribalmemory/mcp/server.py,sha256=URosl0xbxqn0m57bkO52y-pKIBzgkP-f8wTm_MRWzd8,24708
|
|
23
23
|
tribalmemory/performance/__init__.py,sha256=truSiOqk2WuzatOrzVQICwF8pxLxMlCD8R9O-uqiX3I,55
|
|
24
24
|
tribalmemory/performance/benchmarks.py,sha256=2MVfML04Y-05YpmHCsU-SLtS05-H38oJ7a6DCk2qGIc,8985
|
|
25
25
|
tribalmemory/performance/corpus_generator.py,sha256=ovln1d-7JGd5fJbdSRsdxlA0uaqLCVM3Lo_1SDGRkA0,5894
|
|
@@ -27,25 +27,29 @@ tribalmemory/portability/__init__.py,sha256=_USwXZyUKn9idsItv94AAzxKv1wqURYf68Iz
|
|
|
27
27
|
tribalmemory/portability/embedding_metadata.py,sha256=uT_f9jc_vpemY2WxK_UhP3kOAWgZLMRShKKxh3OzzPM,10478
|
|
28
28
|
tribalmemory/server/__init__.py,sha256=2YYwVr1IEr93MVa_7BKCX43bC82-ySnAfwypUw_nQJQ,238
|
|
29
29
|
tribalmemory/server/__main__.py,sha256=Uk2_8MH-aQ65QWDg_XMe5i-hdaQB-yJApLT8YUaIdEs,116
|
|
30
|
-
tribalmemory/server/app.py,sha256=
|
|
31
|
-
tribalmemory/server/config.py,sha256=
|
|
32
|
-
tribalmemory/server/models.py,sha256
|
|
33
|
-
tribalmemory/server/routes.py,sha256=
|
|
30
|
+
tribalmemory/server/app.py,sha256=Ku2UOJ2cnh-RIhtLBaKuZvOx8tjNVbOplhn1U2ePbBM,6796
|
|
31
|
+
tribalmemory/server/config.py,sha256=UHiUIdonPdnsjdZh1vE0C6aOVbP4gS5Bxh7YGJgHh2U,5484
|
|
32
|
+
tribalmemory/server/models.py,sha256=-Y8l5uJ7ij_oiwNtAnLRbmXE9oQlwcBsrCRgnYp14N0,7719
|
|
33
|
+
tribalmemory/server/routes.py,sha256=O2qYpiFYFXY5akTAYcHYmv6AZNqyz3NwnxGPx7GPHFw,13842
|
|
34
34
|
tribalmemory/services/__init__.py,sha256=htv8HuG_r_lYJwP5Q1bwO-oir436U0NfJrOxk9mB7kU,468
|
|
35
35
|
tribalmemory/services/deduplication.py,sha256=E8PaIDB6g24H28tKHrB5rMBJaKGGT3pFTDepXQThvcc,3679
|
|
36
36
|
tribalmemory/services/embeddings.py,sha256=0kY1uPyCg81AlRTNg5QhXbRLDv8hN9khKR4JDGF2sik,10005
|
|
37
|
+
tribalmemory/services/fts_store.py,sha256=5-SBGmzDeQR0-8aDMMO-zZuo8M7VK_tlKYUVDNAitV4,8424
|
|
38
|
+
tribalmemory/services/graph_store.py,sha256=zekWCdmqvZR9qH09FFqp6L7QKSI1z368CKLUDH1osys,24376
|
|
37
39
|
tribalmemory/services/import_export.py,sha256=KfEl5EXAFcuyDmhOYJZfjiIRtJYY4qQlvxv2ePJQHaA,15095
|
|
38
|
-
tribalmemory/services/memory.py,sha256=
|
|
39
|
-
tribalmemory/services/
|
|
40
|
+
tribalmemory/services/memory.py,sha256=uWw-Eg8cJYmzwMsXBxmkGzPRM66Ew13OuRDKBAI2lng,27472
|
|
41
|
+
tribalmemory/services/reranker.py,sha256=0RSvQFHB609aWcxBl92fiwxIbAYILTqNL9MaAp0lQ74,8720
|
|
42
|
+
tribalmemory/services/session_store.py,sha256=wkVF9pNJOqkVXIYOkyvABSaRxaLoHDldT8KTZGThDU0,13818
|
|
43
|
+
tribalmemory/services/vector_store.py,sha256=fL8YgnHiCLPqxqV64pQ_rMLIzdJc6ohN2c4wgGz0buw,15364
|
|
40
44
|
tribalmemory/testing/__init__.py,sha256=XVS3uy0BjABCErgZohaqtj5MF20NKmj1KmtJfRiI_XI,524
|
|
41
45
|
tribalmemory/testing/embedding_utils.py,sha256=E40lSAU7cz-ow2hzKLSaZmafIlOP8d9gakP8R2DTlGM,3705
|
|
42
46
|
tribalmemory/testing/fixtures.py,sha256=_zDyUVm6CQqXK1Us8CN6A95tJcmo1D7LFDktIvjOmwM,3584
|
|
43
47
|
tribalmemory/testing/metrics.py,sha256=X1n84dJDNQXsfGV-i-MzhsWKnFgqHWIcIaQB-BUp0e0,8711
|
|
44
48
|
tribalmemory/testing/mocks.py,sha256=sjLy-pq3D_T21rEvWWKM_bqw7xnchRPGLARZNfKkpGU,19788
|
|
45
49
|
tribalmemory/testing/semantic_expansions.py,sha256=AbbJIXYN4EJT8WKJ7UmIlNRlv63VejbcnbzBy2z2Ofk,2953
|
|
46
|
-
tribalmemory-0.
|
|
47
|
-
tribalmemory-0.
|
|
48
|
-
tribalmemory-0.
|
|
49
|
-
tribalmemory-0.
|
|
50
|
-
tribalmemory-0.
|
|
51
|
-
tribalmemory-0.
|
|
50
|
+
tribalmemory-0.3.0.dist-info/licenses/LICENSE,sha256=M8D9Xf3B6C6DFiCgAAhKcXeTscaC4cw1fhr3LHUrALU,10774
|
|
51
|
+
tribalmemory-0.3.0.dist-info/METADATA,sha256=05lUAOlIf1Zei-I2USroVXkuq2gCijCrCn52B_IqR6Y,9239
|
|
52
|
+
tribalmemory-0.3.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
53
|
+
tribalmemory-0.3.0.dist-info/entry_points.txt,sha256=9Pep7JNCk9ifdFP4WbeCugDOjMrLVegGJ5iuvbcZ9e8,103
|
|
54
|
+
tribalmemory-0.3.0.dist-info/top_level.txt,sha256=kX36ZpH4W7EWcInV4MrIudicusdz5hfkezKMZ3HCMQs,13
|
|
55
|
+
tribalmemory-0.3.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|