lightrag-memgraph 0.3.2__tar.gz → 0.3.3__tar.gz
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.
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/PKG-INFO +1 -1
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/pyproject.toml +1 -1
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/src/lightrag_memgraph/docstatus_impl.py +2 -1
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/tests/test_integration_memgraph.py +36 -0
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/.gitignore +0 -0
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/LICENSE +0 -0
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/README.md +0 -0
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/example.py +0 -0
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/src/lightrag_memgraph/__init__.py +0 -0
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/src/lightrag_memgraph/_connection.py +0 -0
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/src/lightrag_memgraph/core.py +0 -0
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/src/lightrag_memgraph/embeddings.py +0 -0
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/src/lightrag_memgraph/kv_impl.py +0 -0
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/src/lightrag_memgraph/registry.py +0 -0
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/src/lightrag_memgraph/vector_impl.py +0 -0
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/tests/__init__.py +0 -0
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/tests/test_core.py +0 -0
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/tests/test_embeddings.py +0 -0
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/tests/test_import.py +0 -0
- {lightrag_memgraph-0.3.2 → lightrag_memgraph-0.3.3}/tests/test_storages.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: lightrag-memgraph
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: LightRAG integration with Memgraph
|
|
5
5
|
Project-URL: Homepage, https://github.com/memgraph/ai-toolkit
|
|
6
6
|
Project-URL: Source, https://github.com/memgraph/ai-toolkit/tree/main/integrations/lightrag-memgraph
|
|
@@ -240,6 +240,7 @@ class MemgraphDocStatusStorage(MemgraphCrudMixin, DocStatusStorage):
|
|
|
240
240
|
|
|
241
241
|
where = "" if status_values is None else "WHERE n.status IN $statuses"
|
|
242
242
|
sort_expr = "n.id" if sort_field == "id" else f"n.{sort_field}"
|
|
243
|
+
order_by = f"{sort_expr} {order}" if sort_field == "id" else f"n.{sort_field} {order}, n.id {order}"
|
|
243
244
|
params: dict[str, Any] = {"skip": skip, "limit": page_size}
|
|
244
245
|
filter_params: dict[str, Any] = {}
|
|
245
246
|
if status_values is not None:
|
|
@@ -265,7 +266,7 @@ class MemgraphDocStatusStorage(MemgraphCrudMixin, DocStatusStorage):
|
|
|
265
266
|
f"""
|
|
266
267
|
MATCH (n:`{self._label}`) {where}
|
|
267
268
|
RETURN n.id AS id, n.data AS data
|
|
268
|
-
ORDER BY {
|
|
269
|
+
ORDER BY {order_by}
|
|
269
270
|
SKIP $skip LIMIT $limit
|
|
270
271
|
"""
|
|
271
272
|
),
|
|
@@ -368,6 +368,42 @@ async def test_doc_status_roundtrip(shared_driver, workspace):
|
|
|
368
368
|
await store.drop()
|
|
369
369
|
|
|
370
370
|
|
|
371
|
+
@pytest.mark.parametrize("sort_direction", ["asc", "desc"])
|
|
372
|
+
async def test_doc_status_pagination_breaks_ties_by_id(shared_driver, workspace, sort_direction):
|
|
373
|
+
store = MemgraphDocStatusStorage(
|
|
374
|
+
namespace="doc_status",
|
|
375
|
+
workspace=workspace,
|
|
376
|
+
global_config=_global_config(),
|
|
377
|
+
embedding_func=_fake_embedding_func(),
|
|
378
|
+
)
|
|
379
|
+
await store.initialize()
|
|
380
|
+
try:
|
|
381
|
+
doc_count = 25 # page_size is clamped to >= 10, so this spans three pages
|
|
382
|
+
doc_ids = [f"doc-{i:02d}" for i in range(doc_count)]
|
|
383
|
+
# Written out of id order, so storage order can't pass for the tiebreaker.
|
|
384
|
+
scrambled = [doc_ids[(i * 7) % doc_count] for i in range(doc_count)]
|
|
385
|
+
# _doc() gives every document the same updated_at: the whole set is one tie.
|
|
386
|
+
await store.upsert({doc_id: _doc(DocStatus.PROCESSED, doc_id, f"{doc_id}.txt") for doc_id in scrambled})
|
|
387
|
+
|
|
388
|
+
async def page_through() -> list[str]:
|
|
389
|
+
seen: list[str] = []
|
|
390
|
+
for page_number in (1, 2, 3):
|
|
391
|
+
page, total = await store.get_docs_paginated(
|
|
392
|
+
page=page_number, page_size=10, sort_direction=sort_direction
|
|
393
|
+
)
|
|
394
|
+
assert total == doc_count
|
|
395
|
+
seen.extend(doc_id for doc_id, _ in page)
|
|
396
|
+
return seen
|
|
397
|
+
|
|
398
|
+
first_pass = await page_through()
|
|
399
|
+
assert len(first_pass) == len(set(first_pass)), "a document appeared on more than one page"
|
|
400
|
+
assert set(first_pass) == set(doc_ids), "a document was missing from every page"
|
|
401
|
+
assert first_pass == sorted(doc_ids, reverse=sort_direction == "desc")
|
|
402
|
+
assert await page_through() == first_pass
|
|
403
|
+
finally:
|
|
404
|
+
await store.drop()
|
|
405
|
+
|
|
406
|
+
|
|
371
407
|
# --- vector storage ----------------------------------------------------------
|
|
372
408
|
|
|
373
409
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|