From c7bc4fc42cd0e1f301ca7f0ad7d1b6a451754b2d Mon Sep 17 00:00:00 2001 From: yangdx Date: Wed, 30 Jul 2025 10:27:12 +0800 Subject: [PATCH] Add track_id return to document processing pipeline --- lightrag/lightrag.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lightrag/lightrag.py b/lightrag/lightrag.py index 0efafc14..8974ee8b 100644 --- a/lightrag/lightrag.py +++ b/lightrag/lightrag.py @@ -802,7 +802,7 @@ class LightRAG: ids: list[str] | None = None, file_paths: str | list[str] | None = None, track_id: str | None = None, - ) -> None: + ) -> str: """ Pipeline for Processing Documents @@ -816,7 +816,14 @@ class LightRAG: input: Single document string or list of document strings ids: list of unique document IDs, if not provided, MD5 hash IDs will be generated file_paths: list of file paths corresponding to each document, used for citation + track_id: tracking ID for monitoring processing status, if not provided, will be generated with "enqueue" prefix + + Returns: + str: tracking ID for monitoring processing status """ + # Generate track_id if not provided + if track_id is None or track_id.strip() == "": + track_id = generate_track_id("enqueue") if isinstance(input, str): input = [input] if isinstance(ids, str): @@ -942,6 +949,8 @@ class LightRAG: await self.doc_status.upsert(new_docs) logger.info(f"Stored {len(new_docs)} new unique documents") + return track_id + async def apipeline_process_enqueue_documents( self, split_by_character: str | None = None,