improving ainsert_custom_chunks paralelism
This commit is contained in:
@@ -437,27 +437,13 @@ class LightRAG:
|
|||||||
logger.warning("All chunks are already in the storage.")
|
logger.warning("All chunks are already in the storage.")
|
||||||
return
|
return
|
||||||
|
|
||||||
logger.info(f"[New Chunks] inserting {len(inserting_chunks)} chunks")
|
tasks = [
|
||||||
|
self.chunks_vdb.upsert(inserting_chunks),
|
||||||
await self.chunks_vdb.upsert(inserting_chunks)
|
self._process_entity_relation_graph(inserting_chunks),
|
||||||
|
self.full_docs.upsert(new_docs),
|
||||||
logger.info("[Entity Extraction]...")
|
self.text_chunks.upsert(inserting_chunks),
|
||||||
maybe_new_kg = await extract_entities(
|
]
|
||||||
inserting_chunks,
|
await asyncio.gather(*tasks)
|
||||||
knowledge_graph_inst=self.chunk_entity_relation_graph,
|
|
||||||
entity_vdb=self.entities_vdb,
|
|
||||||
relationships_vdb=self.relationships_vdb,
|
|
||||||
global_config=asdict(self),
|
|
||||||
)
|
|
||||||
|
|
||||||
if maybe_new_kg is None:
|
|
||||||
logger.warning("No new entities and relationships found")
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
self.chunk_entity_relation_graph = maybe_new_kg
|
|
||||||
|
|
||||||
await self.full_docs.upsert(new_docs)
|
|
||||||
await self.text_chunks.upsert(inserting_chunks)
|
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
if update_storage:
|
if update_storage:
|
||||||
|
Reference in New Issue
Block a user