Skip to content

Commit 0320aa4

Browse files
authoredMar 3, 2025··
Merge pull request #971 from Volve-Technologies/abyl/adding_full_doc_id
adding full_doc_id to insert
2 parents 2d6d0be + bf0ddc6 commit 0320aa4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎lightrag/lightrag.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -952,11 +952,11 @@ async def _insert_done(self) -> None:
952952
pipeline_status["latest_message"] = log_message
953953
pipeline_status["history_messages"].append(log_message)
954954

955-
def insert_custom_kg(self, custom_kg: dict[str, Any]) -> None:
955+
def insert_custom_kg(self, custom_kg: dict[str, Any], full_doc_id: str = None) -> None:
956956
loop = always_get_an_event_loop()
957-
loop.run_until_complete(self.ainsert_custom_kg(custom_kg))
957+
loop.run_until_complete(self.ainsert_custom_kg(custom_kg, full_doc_id))
958958

959-
async def ainsert_custom_kg(self, custom_kg: dict[str, Any]) -> None:
959+
async def ainsert_custom_kg(self, custom_kg: dict[str, Any], full_doc_id: str = None) -> None:
960960
update_storage = False
961961
try:
962962
# Insert chunks into vector storage
@@ -982,7 +982,7 @@ async def ainsert_custom_kg(self, custom_kg: dict[str, Any]) -> None:
982982
"source_id": source_id,
983983
"tokens": tokens,
984984
"chunk_order_index": chunk_order_index,
985-
"full_doc_id": source_id,
985+
"full_doc_id": full_doc_id if full_doc_id is not None else source_id,
986986
"status": DocStatus.PROCESSED,
987987
}
988988
all_chunks_data[chunk_id] = chunk_entry

0 commit comments

Comments
 (0)
Please sign in to comment.