Files
ailine/backend/app/graph/__init__.py

74 lines
1.5 KiB
Python
Raw Permalink Normal View History

2026-04-21 11:02:16 +08:00
"""
Graph 子模块 - React 模式增强版带超时重试
2026-04-21 11:02:16 +08:00
"""
from .graph_builder import GraphBuilder
from .subgraph_builder import build_main_graph, build_react_main_graph
from .react_nodes import (
init_state_node,
react_reason_node,
error_handling_node,
final_response_node,
route_by_reasoning
)
from .rag_nodes import (
rag_retrieve_node,
rag_re_retrieve_node,
inject_rag_tool_to_state,
get_rag_tool_from_state
)
from .state import (
MessagesState,
GraphContext,
MainGraphState,
CurrentAction,
ErrorRecord,
ErrorSeverity
)
from .retry_utils import (
RetryConfig,
RetryResult,
RetryStrategy,
with_retry,
with_async_retry,
create_retry_wrapper_for_node,
RAG_RETRY_CONFIG,
SUBGRAPH_RETRY_CONFIG
)
2026-04-21 11:02:16 +08:00
__all__ = [
# 旧版兼容性
"GraphBuilder",
"build_main_graph",
"MessagesState",
"GraphContext",
"MainGraphState",
"CurrentAction",
# 新版 React 模式
"build_react_main_graph",
"init_state_node",
"react_reason_node",
"error_handling_node",
"final_response_node",
"route_by_reasoning",
"ErrorRecord",
"ErrorSeverity",
# RAG 节点(独立模块)
"rag_retrieve_node",
"rag_re_retrieve_node",
"inject_rag_tool_to_state",
"get_rag_tool_from_state",
# 超时和重试工具
"RetryConfig",
"RetryResult",
"RetryStrategy",
"with_retry",
"with_async_retry",
"create_retry_wrapper_for_node",
"RAG_RETRY_CONFIG",
"SUBGRAPH_RETRY_CONFIG"
]