Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding full_doc_id to insert #971

Merged
merged 2 commits into from
Mar 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lightrag/lightrag.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,11 +835,11 @@ async def _insert_done(self) -> None:
await asyncio.gather(*tasks)
logger.info("All Insert done")

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

async def ainsert_custom_kg(self, custom_kg: dict[str, Any]) -> None:
async def ainsert_custom_kg(self, custom_kg: dict[str, Any], full_doc_id: str = None) -> None:
update_storage = False
try:
# Insert chunks into vector storage
Expand All @@ -865,7 +865,7 @@ async def ainsert_custom_kg(self, custom_kg: dict[str, Any]) -> None:
"source_id": source_id,
"tokens": tokens,
"chunk_order_index": chunk_order_index,
"full_doc_id": source_id,
"full_doc_id": full_doc_id if full_doc_id is not None else source_id,
"status": DocStatus.PROCESSED,
}
all_chunks_data[chunk_id] = chunk_entry
Expand Down
Loading