From 911b20caf0483ce6b5f4377da7f8a40934e85ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benno=20L=C3=B6ffler?= Date: Tue, 1 Apr 2025 06:31:44 +0200 Subject: [PATCH] fix: error 'history_messages' with LightRAG latest version (#719) bump:patch * fix: Error: 'history_messages' with LightRAG * added comment --- libs/ktem/ktem/index/file/graph/lightrag_pipelines.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libs/ktem/ktem/index/file/graph/lightrag_pipelines.py b/libs/ktem/ktem/index/file/graph/lightrag_pipelines.py index 2f8bc88..694ad40 100644 --- a/libs/ktem/ktem/index/file/graph/lightrag_pipelines.py +++ b/libs/ktem/ktem/index/file/graph/lightrag_pipelines.py @@ -29,6 +29,10 @@ from .visualize import create_knowledge_graph, visualize_graph try: from lightrag import LightRAG, QueryParam + + # newer verisons of LightRAG needs to be initialized before using + from lightrag.kg.shared_storage import initialize_pipeline_status + from lightrag.operate import ( _find_most_related_edges_from_entities, _find_most_related_text_unit_from_entities, @@ -235,6 +239,11 @@ def build_graphrag(working_dir, llm_func, embedding_func): llm_model_func=llm_func, embedding_func=embedding_func, ) + + # newer verisons of LightRAG needs to be initialized before using + asyncio.run(graphrag_func.initialize_storages()) + asyncio.run(initialize_pipeline_status()) + return graphrag_func