Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Refa: Clean the folders. (#12890)

Kevin Hu32c0161ff10d
diff --git a/CLAUDE.md b/CLAUDE.md
index d774fc376c..58d1217afe 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -27,7 +27,7 @@ RAGFlow is an open-source RAG (Retrieval-Augmented Generation) engine based on d
- **Document Processing**: `deepdoc/` - PDF parsing, OCR, layout analysis
- **LLM Integration**: `rag/llm/` - Model abstractions for chat, embedding, reranking
- **RAG Pipeline**: `rag/flow/` - Chunking, parsing, tokenization
-- **Graph RAG**: `graphrag/` - Knowledge graph construction and querying
+- **Graph RAG**: `rag/graphrag/` - Knowledge graph construction and querying
### Agent System (`/agent/`)
- **Components**: Modular workflow components (LLM, retrieval, categorize, etc.)
@@ -113,4 +113,4 @@ RAGFlow supports switching between Elasticsearch (default) and Infinity:
- Node.js >=18.20.4
- Docker & Docker Compose
- uv package manager
-- 16GB+ RAM, 50GB+ disk space
\ No newline at end of file
+- 16GB+ RAM, 50GB+ disk space
diff --git a/Dockerfile b/Dockerfile
index 1da8843435..c1859878ea 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -192,10 +192,8 @@ COPY conf conf
COPY deepdoc deepdoc
COPY rag rag
COPY agent agent
-COPY graphrag graphrag
COPY pyproject.toml uv.lock ./
COPY mcp mcp
-COPY plugin plugin
COPY common common
COPY memory memory
diff --git a/plugin/README.md b/agent/plugin/README.md
similarity index 98%
rename from plugin/README.md
rename to agent/plugin/README.md
index cd11e91dbc..4f1ac152c1 100644
--- a/plugin/README.md
+++ b/agent/plugin/README.md
@@ -23,7 +23,7 @@ All the execution logic of this tool should go into this method.
When you start RAGFlow, you can see your plugin was loaded in the log:
```
-2025-05-15 19:29:08,959 INFO 34670 Recursively importing plugins from path `/some-path/ragflow/plugin/embedded_plugins`
+2025-05-15 19:29:08,959 INFO 34670 Recursively importing plugins from path `/some-path/ragflow/agent/plugin/embedded_plugins`
2025-05-15 19:29:08,960 INFO 34670 Loaded llm_tools plugin BadCalculatorPlugin version 1.0.0
```
diff --git a/plugin/README_zh.md b/agent/plugin/README_zh.md
similarity index 98%
rename from plugin/README_zh.md
rename to agent/plugin/README_zh.md
index 17b3dd703d..eb9910ba40 100644
--- a/plugin/README_zh.md
+++ b/agent/plugin/README_zh.md
@@ -23,7 +23,7 @@ RAGFlow将会从`embedded_plugins`子文件夹中递归加载所有的插件。
当你启动RAGFlow时,你会在日志中看见你的插件被加载了:
```
-2025-05-15 19:29:08,959 INFO 34670 Recursively importing plugins from path `/some-path/ragflow/plugin/embedded_plugins`
+2025-05-15 19:29:08,959 INFO 34670 Recursively importing plugins from path `/some-path/ragflow/agent/plugin/embedded_plugins`
2025-05-15 19:29:08,960 INFO 34670 Loaded llm_tools plugin BadCalculatorPlugin version 1.0.0
```
diff --git a/plugin/__init__.py b/agent/plugin/__init__.py
similarity index 100%
rename from plugin/__init__.py
rename to agent/plugin/__init__.py
diff --git a/plugin/common.py b/agent/plugin/common.py
similarity index 100%
rename from plugin/common.py
rename to agent/plugin/common.py
diff --git a/plugin/embedded_plugins/llm_tools/bad_calculator.py b/agent/plugin/embedded_plugins/llm_tools/bad_calculator.py
similarity index 94%
rename from plugin/embedded_plugins/llm_tools/bad_calculator.py
rename to agent/plugin/embedded_plugins/llm_tools/bad_calculator.py
index 04c3b815a3..38376aa984 100644
--- a/plugin/embedded_plugins/llm_tools/bad_calculator.py
+++ b/agent/plugin/embedded_plugins/llm_tools/bad_calculator.py
@@ -1,5 +1,5 @@
import logging
-from plugin.llm_tool_plugin import LLMToolMetadata, LLMToolPlugin
+from agent.plugin.llm_tool_plugin import LLMToolMetadata, LLMToolPlugin
class BadCalculatorPlugin(LLMToolPlugin):
diff --git a/plugin/llm_tool_plugin.py b/agent/plugin/llm_tool_plugin.py
similarity index 100%
rename from plugin/llm_tool_plugin.py
rename to agent/plugin/llm_tool_plugin.py
diff --git a/plugin/plugin_manager.py b/agent/plugin/plugin_manager.py
similarity index 100%
rename from plugin/plugin_manager.py
rename to agent/plugin/plugin_manager.py
diff --git a/api/apps/plugin_app.py b/api/apps/plugin_app.py
index 6e7a876901..fb0a7bb610 100644
--- a/api/apps/plugin_app.py
+++ b/api/apps/plugin_app.py
@@ -18,7 +18,7 @@
from quart import Response
from api.apps import login_required
from api.utils.api_utils import get_json_result
-from plugin import GlobalPluginManager
+from agent.plugin import GlobalPluginManager
@manager.route('/llm_tools', methods=['GET']) # noqa: F821
diff --git a/api/db/services/dialog_service.py b/api/db/services/dialog_service.py
index 1a25a8308d..8a11397e4d 100644
--- a/api/db/services/dialog_service.py
+++ b/api/db/services/dialog_service.py
@@ -35,7 +35,7 @@ from api.db.services.llm_service import LLMBundle
from common.metadata_utils import apply_meta_data_filter
from api.db.services.tenant_llm_service import TenantLLMService
from common.time_utils import current_timestamp, datetime_format
-from graphrag.general.mind_map_extractor import MindMapExtractor
+from rag.graphrag.general.mind_map_extractor import MindMapExtractor
from rag.advanced_rag import DeepResearcher
from rag.app.tag import label_question
from rag.nlp.search import index_name
diff --git a/api/db/services/document_service.py b/api/db/services/document_service.py
index 99e0f0f8fd..4f015ddd58 100644
--- a/api/db/services/document_service.py
+++ b/api/db/services/document_service.py
@@ -1077,7 +1077,7 @@ def doc_upload_and_parse(conversation_id, file_objs, user_id):
cks = [c for c in docs if c["doc_id"] == doc_id]
if parser_ids[doc_id] != ParserType.PICTURE.value:
- from graphrag.general.mind_map_extractor import MindMapExtractor
+ from rag.graphrag.general.mind_map_extractor import MindMapExtractor
mindmap = MindMapExtractor(llm_bdl)
try:
mind_map = asyncio.run(mindmap([c["content_with_weight"] for c in docs if c["doc_id"] == doc_id]))
diff --git a/api/ragflow_server.py b/api/ragflow_server.py
index 193efff3b2..1beb0cd099 100644
--- a/api/ragflow_server.py
+++ b/api/ragflow_server.py
@@ -41,7 +41,7 @@ from common.versions import get_ragflow_version
from common.config_utils import show_configs
from common.mcp_tool_call_conn import shutdown_all_mcp_sessions
from common.log_utils import init_root_logger
-from plugin import GlobalPluginManager
+from agent.plugin import GlobalPluginManager
from rag.utils.redis_conn import RedisDistributedLock
stop_event = threading.Event()
diff --git a/common/settings.py b/common/settings.py
index 83415c680a..41ac2f5eb4 100644
--- a/common/settings.py
+++ b/common/settings.py
@@ -317,7 +317,7 @@ def init_settings():
global retriever, kg_retriever
retriever = search.Dealer(docStoreConn)
- from graphrag import search as kg_search
+ from rag.graphrag import search as kg_search
kg_retriever = kg_search.KGSearch(docStoreConn)
diff --git a/chat_demo/index.html b/example/chat_demo/index.html
similarity index 100%
rename from chat_demo/index.html
rename to example/chat_demo/index.html
diff --git a/chat_demo/widget_demo.html b/example/chat_demo/widget_demo.html
similarity index 100%
rename from chat_demo/widget_demo.html
rename to example/chat_demo/widget_demo.html
diff --git a/rag/app/tag.py b/rag/app/tag.py
index 8e516a75ff..d43692f612 100644
--- a/rag/app/tag.py
+++ b/rag/app/tag.py
@@ -124,7 +124,7 @@ def chunk(filename, binary=None, lang="Chinese", callback=None, **kwargs):
def label_question(question, kbs):
from api.db.services.knowledgebase_service import KnowledgebaseService
- from graphrag.utils import get_tags_from_cache, set_tags_to_cache
+ from rag.graphrag.utils import get_tags_from_cache, set_tags_to_cache
tags = None
tag_kb_ids = []
for kb in kbs:
diff --git a/graphrag/__init__.py b/rag/graphrag/__init__.py
similarity index 100%
rename from graphrag/__init__.py
rename to rag/graphrag/__init__.py
diff --git a/graphrag/entity_resolution.py b/rag/graphrag/entity_resolution.py
similarity index 98%
rename from graphrag/entity_resolution.py
rename to rag/graphrag/entity_resolution.py
index ec65e84b70..5639e2a9c7 100644
--- a/graphrag/entity_resolution.py
+++ b/rag/graphrag/entity_resolution.py
@@ -23,12 +23,12 @@ from typing import Any, Callable
import networkx as nx
-from graphrag.general.extractor import Extractor
+from rag.graphrag.general.extractor import Extractor
from rag.nlp import is_english
import editdistance
-from graphrag.entity_resolution_prompt import ENTITY_RESOLUTION_PROMPT
+from rag.graphrag.entity_resolution_prompt import ENTITY_RESOLUTION_PROMPT
from rag.llm.chat_model import Base as CompletionLLM
-from graphrag.utils import perform_variable_replacements, chat_limiter, GraphChange
+from rag.graphrag.utils import perform_variable_replacements, chat_limiter, GraphChange
from api.db.services.task_service import has_canceled
from common.exceptions import TaskCanceledException
diff --git a/graphrag/entity_resolution_prompt.py b/rag/graphrag/entity_resolution_prompt.py
similarity index 100%
rename from graphrag/entity_resolution_prompt.py
rename to rag/graphrag/entity_resolution_prompt.py
diff --git a/graphrag/general/__init__.py b/rag/graphrag/general/__init__.py
similarity index 100%
rename from graphrag/general/__init__.py
rename to rag/graphrag/general/__init__.py
diff --git a/graphrag/general/community_report_prompt.py b/rag/graphrag/general/community_report_prompt.py
similarity index 100%
rename from graphrag/general/community_report_prompt.py
rename to rag/graphrag/general/community_report_prompt.py
diff --git a/graphrag/general/community_reports_extractor.py b/rag/graphrag/general/community_reports_extractor.py
similarity index 95%
rename from graphrag/general/community_reports_extractor.py
rename to rag/graphrag/general/community_reports_extractor.py
index 9a01f98c66..4c616ac5a7 100644
--- a/graphrag/general/community_reports_extractor.py
+++ b/rag/graphrag/general/community_reports_extractor.py
@@ -21,12 +21,12 @@ import pandas as pd
from api.db.services.task_service import has_canceled
from common.exceptions import TaskCanceledException
from common.connection_utils import timeout
-from graphrag.general import leiden
-from graphrag.general.community_report_prompt import COMMUNITY_REPORT_PROMPT
-from graphrag.general.extractor import Extractor
-from graphrag.general.leiden import add_community_info2graph
+from rag.graphrag.general import leiden
+from rag.graphrag.general.community_report_prompt import COMMUNITY_REPORT_PROMPT
+from rag.graphrag.general.extractor import Extractor
+from rag.graphrag.general.leiden import add_community_info2graph
from rag.llm.chat_model import Base as CompletionLLM
-from graphrag.utils import perform_variable_replacements, dict_has_keys_with_types, chat_limiter
+from rag.graphrag.utils import perform_variable_replacements, dict_has_keys_with_types, chat_limiter
from common.token_utils import num_tokens_from_string
@dataclass
diff --git a/graphrag/general/entity_embedding.py b/rag/graphrag/general/entity_embedding.py
similarity index 94%
rename from graphrag/general/entity_embedding.py
rename to rag/graphrag/general/entity_embedding.py
index 78c7fc31d4..993f8474ec 100644
--- a/graphrag/general/entity_embedding.py
+++ b/rag/graphrag/general/entity_embedding.py
@@ -9,7 +9,7 @@ from typing import Any
import numpy as np
import networkx as nx
from dataclasses import dataclass
-from graphrag.general.leiden import stable_largest_connected_component
+from rag.graphrag.general.leiden import stable_largest_connected_component
import graspologic as gc
@@ -63,4 +63,4 @@ def run(graph: nx.Graph, args: dict[str, Any]) -> dict:
pairs = zip(embeddings.nodes, embeddings.embeddings.tolist(), strict=True)
sorted_pairs = sorted(pairs, key=lambda x: x[0])
- return dict(sorted_pairs)
\ No newline at end of file
+ return dict(sorted_pairs)
diff --git a/graphrag/general/extractor.py b/rag/graphrag/general/extractor.py
similarity index 99%
rename from graphrag/general/extractor.py
rename to rag/graphrag/general/extractor.py
index 899845a83d..ccb0d3ba8b 100644
--- a/graphrag/general/extractor.py
+++ b/rag/graphrag/general/extractor.py
@@ -26,8 +26,8 @@ import networkx as nx
from api.db.services.task_service import has_canceled
from common.connection_utils import timeout
from common.token_utils import truncate
-from graphrag.general.graph_prompt import SUMMARIZE_DESCRIPTIONS_PROMPT
-from graphrag.utils import (
+from rag.graphrag.general.graph_prompt import SUMMARIZE_DESCRIPTIONS_PROMPT
+from rag.graphrag.utils import (
GraphChange,
chat_limiter,
flat_uniq_list,
diff --git a/graphrag/general/graph_extractor.py b/rag/graphrag/general/graph_extractor.py
similarity index 95%
rename from graphrag/general/graph_extractor.py
rename to rag/graphrag/general/graph_extractor.py
index c769acd941..26caa93f2a 100644
--- a/graphrag/general/graph_extractor.py
+++ b/rag/graphrag/general/graph_extractor.py
@@ -13,9 +13,9 @@ from typing import Any
from dataclasses import dataclass
import tiktoken
-from graphrag.general.extractor import Extractor, ENTITY_EXTRACTION_MAX_GLEANINGS
-from graphrag.general.graph_prompt import GRAPH_EXTRACTION_PROMPT, CONTINUE_PROMPT, LOOP_PROMPT
-from graphrag.utils import ErrorHandlerFn, perform_variable_replacements, chat_limiter, split_string_by_multi_markers
+from rag.graphrag.general.extractor import Extractor, ENTITY_EXTRACTION_MAX_GLEANINGS
+from rag.graphrag.general.graph_prompt import GRAPH_EXTRACTION_PROMPT, CONTINUE_PROMPT, LOOP_PROMPT
+from rag.graphrag.utils import ErrorHandlerFn, perform_variable_replacements, chat_limiter, split_string_by_multi_markers
from rag.llm.chat_model import Base as CompletionLLM
import networkx as nx
from common.token_utils import num_tokens_from_string
diff --git a/graphrag/general/graph_prompt.py b/rag/graphrag/general/graph_prompt.py
similarity index 100%
rename from graphrag/general/graph_prompt.py
rename to rag/graphrag/general/graph_prompt.py
diff --git a/graphrag/general/index.py b/rag/graphrag/general/index.py
similarity index 98%
rename from graphrag/general/index.py
rename to rag/graphrag/general/index.py
index 632d374948..1a43ebe092 100644
--- a/graphrag/general/index.py
+++ b/rag/graphrag/general/index.py
@@ -25,12 +25,12 @@ from api.db.services.task_service import has_canceled
from common.exceptions import TaskCanceledException
from common.misc_utils import get_uuid
from common.connection_utils import timeout
-from graphrag.entity_resolution import EntityResolution
-from graphrag.general.community_reports_extractor import CommunityReportsExtractor
-from graphrag.general.extractor import Extractor
-from graphrag.general.graph_extractor import GraphExtractor as GeneralKGExt
-from graphrag.light.graph_extractor import GraphExtractor as LightKGExt
-from graphrag.utils import (
+from rag.graphrag.entity_resolution import EntityResolution
+from rag.graphrag.general.community_reports_extractor import CommunityReportsExtractor
+from rag.graphrag.general.extractor import Extractor
+from rag.graphrag.general.graph_extractor import GraphExtractor as GeneralKGExt
+from rag.graphrag.light.graph_extractor import GraphExtractor as LightKGExt
+from rag.graphrag.utils import (
GraphChange,
chunk_id,
does_graph_contains,
diff --git a/graphrag/general/leiden.py b/rag/graphrag/general/leiden.py
similarity index 100%
rename from graphrag/general/leiden.py
rename to rag/graphrag/general/leiden.py
diff --git a/graphrag/general/mind_map_extractor.py b/rag/graphrag/general/mind_map_extractor.py
similarity index 96%
rename from graphrag/general/mind_map_extractor.py
rename to rag/graphrag/general/mind_map_extractor.py
index f221e89f9b..3e7c5d9ae2 100644
--- a/graphrag/general/mind_map_extractor.py
+++ b/rag/graphrag/general/mind_map_extractor.py
@@ -21,9 +21,9 @@ import re
from typing import Any
from dataclasses import dataclass
-from graphrag.general.extractor import Extractor
-from graphrag.general.mind_map_prompt import MIND_MAP_EXTRACTION_PROMPT
-from graphrag.utils import ErrorHandlerFn, perform_variable_replacements, chat_limiter
+from rag.graphrag.general.extractor import Extractor
+from rag.graphrag.general.mind_map_prompt import MIND_MAP_EXTRACTION_PROMPT
+from rag.graphrag.utils import ErrorHandlerFn, perform_variable_replacements, chat_limiter
from rag.llm.chat_model import Base as CompletionLLM
import markdown_to_json
from functools import reduce
diff --git a/graphrag/general/mind_map_prompt.py b/rag/graphrag/general/mind_map_prompt.py
similarity index 100%
rename from graphrag/general/mind_map_prompt.py
rename to rag/graphrag/general/mind_map_prompt.py
diff --git a/graphrag/general/smoke.py b/rag/graphrag/general/smoke.py
similarity index 95%
rename from graphrag/general/smoke.py
rename to rag/graphrag/general/smoke.py
index ba405e193f..0070270379 100644
--- a/graphrag/general/smoke.py
+++ b/rag/graphrag/general/smoke.py
@@ -25,8 +25,8 @@ from api.db.services.document_service import DocumentService
from api.db.services.knowledgebase_service import KnowledgebaseService
from api.db.services.llm_service import LLMBundle
from api.db.services.user_service import TenantService
-from graphrag.general.graph_extractor import GraphExtractor
-from graphrag.general.index import update_graph, with_resolution, with_community
+from rag.graphrag.general.graph_extractor import GraphExtractor
+from rag.graphrag.general.index import update_graph, with_resolution, with_community
from common import settings
settings.init_settings()
diff --git a/graphrag/light/__init__.py b/rag/graphrag/light/__init__.py
similarity index 100%
rename from graphrag/light/__init__.py
rename to rag/graphrag/light/__init__.py
diff --git a/graphrag/light/graph_extractor.py b/rag/graphrag/light/graph_extractor.py
similarity index 95%
rename from graphrag/light/graph_extractor.py
rename to rag/graphrag/light/graph_extractor.py
index 027589ca9e..b304e6ad80 100644
--- a/graphrag/light/graph_extractor.py
+++ b/rag/graphrag/light/graph_extractor.py
@@ -15,9 +15,9 @@ from typing import Any
import networkx as nx
-from graphrag.general.extractor import ENTITY_EXTRACTION_MAX_GLEANINGS, Extractor
-from graphrag.light.graph_prompt import PROMPTS
-from graphrag.utils import chat_limiter, pack_user_ass_to_openai_messages, split_string_by_multi_markers
+from rag.graphrag.general.extractor import ENTITY_EXTRACTION_MAX_GLEANINGS, Extractor
+from rag.graphrag.light.graph_prompt import PROMPTS
+from rag.graphrag.utils import chat_limiter, pack_user_ass_to_openai_messages, split_string_by_multi_markers
from rag.llm.chat_model import Base as CompletionLLM
from common.token_utils import num_tokens_from_string
diff --git a/graphrag/light/graph_prompt.py b/rag/graphrag/light/graph_prompt.py
similarity index 100%
rename from graphrag/light/graph_prompt.py
rename to rag/graphrag/light/graph_prompt.py
diff --git a/graphrag/light/smoke.py b/rag/graphrag/light/smoke.py
similarity index 95%
rename from graphrag/light/smoke.py
rename to rag/graphrag/light/smoke.py
index bfa3ca256f..2688e0bb60 100644
--- a/graphrag/light/smoke.py
+++ b/rag/graphrag/light/smoke.py
@@ -25,8 +25,8 @@ from api.db.services.document_service import DocumentService
from api.db.services.knowledgebase_service import KnowledgebaseService
from api.db.services.llm_service import LLMBundle
from api.db.services.user_service import TenantService
-from graphrag.general.index import update_graph
-from graphrag.light.graph_extractor import GraphExtractor
+from rag.graphrag.general.index import update_graph
+from rag.graphrag.light.graph_extractor import GraphExtractor
from common import settings
settings.init_settings()
diff --git a/graphrag/query_analyze_prompt.py b/rag/graphrag/query_analyze_prompt.py
similarity index 100%
rename from graphrag/query_analyze_prompt.py
rename to rag/graphrag/query_analyze_prompt.py
diff --git a/graphrag/search.py b/rag/graphrag/search.py
similarity index 98%
rename from graphrag/search.py
rename to rag/graphrag/search.py
index 64abfd68a1..6b6ebb82a3 100644
--- a/graphrag/search.py
+++ b/rag/graphrag/search.py
@@ -22,8 +22,8 @@ import json_repair
import pandas as pd
from common.misc_utils import get_uuid
-from graphrag.query_analyze_prompt import PROMPTS
-from graphrag.utils import get_entity_type2samples, get_llm_cache, set_llm_cache, get_relation
+from rag.graphrag.query_analyze_prompt import PROMPTS
+from rag.graphrag.utils import get_entity_type2samples, get_llm_cache, set_llm_cache, get_relation
from common.token_utils import num_tokens_from_string
from rag.nlp.search import Dealer, index_name
diff --git a/graphrag/utils.py b/rag/graphrag/utils.py
similarity index 100%
rename from graphrag/utils.py
rename to rag/graphrag/utils.py
diff --git a/rag/prompts/generator.py b/rag/prompts/generator.py
index 5f834d85a3..d3d7b65a65 100644
--- a/rag/prompts/generator.py
+++ b/rag/prompts/generator.py
@@ -492,7 +492,7 @@ async def gen_meta_filter(chat_mdl, meta_data: dict, query: str) -> dict:
async def gen_json(system_prompt: str, user_prompt: str, chat_mdl, gen_conf={}, max_retry=2):
- from graphrag.utils import get_llm_cache, set_llm_cache
+ from rag.graphrag.utils import get_llm_cache, set_llm_cache
cached = get_llm_cache(chat_mdl.llm_name, system_prompt, user_prompt, gen_conf)
if cached:
return json_repair.loads(cached)
@@ -928,4 +928,4 @@ async def multi_queries_gen(chat_mdl, question: str, query:str, missing_infos:li
)
except Exception as e:
logging.exception(e)
- return {}
\ No newline at end of file
+ return {}
diff --git a/rag/raptor.py b/rag/raptor.py
index ce9e5345e9..ac2325d648 100644
--- a/rag/raptor.py
+++ b/rag/raptor.py
@@ -25,7 +25,7 @@ from api.db.services.task_service import has_canceled
from common.connection_utils import timeout
from common.exceptions import TaskCanceledException
from common.token_utils import truncate
-from graphrag.utils import (
+from rag.graphrag.utils import (
chat_limiter,
get_embed_cache,
get_llm_cache,
diff --git a/rag/svr/task_executor.py b/rag/svr/task_executor.py
index c414f21ee3..c5f31cf213 100644
--- a/rag/svr/task_executor.py
+++ b/rag/svr/task_executor.py
@@ -40,8 +40,8 @@ from rag.utils.base64_image import image2id
from rag.utils.raptor_utils import should_skip_raptor, get_skip_reason
from common.log_utils import init_root_logger
from common.config_utils import show_configs
-from graphrag.general.index import run_graphrag_for_kb
-from graphrag.utils import get_llm_cache, set_llm_cache, get_tags_from_cache, set_tags_to_cache
+from rag.graphrag.general.index import run_graphrag_for_kb
+from rag.graphrag.utils import get_llm_cache, set_llm_cache, get_tags_from_cache, set_tags_to_cache
from rag.prompts.generator import keyword_extraction, question_proposal, content_tagging, run_toc_from_text, \
gen_metadata
import logging
@@ -73,7 +73,7 @@ from rag.nlp import search, rag_tokenizer, add_positions
from rag.raptor import RecursiveAbstractiveProcessing4TreeOrganizedRetrieval as Raptor
from common.token_utils import num_tokens_from_string, truncate
from rag.utils.redis_conn import REDIS_CONN, RedisDistributedLock
-from graphrag.utils import chat_limiter
+from rag.graphrag.utils import chat_limiter
from common.signal_utils import start_tracemalloc_and_snapshot, stop_tracemalloc
from common.exceptions import TaskCanceledException
from common import settings