Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Has been cancelled
- 新增 rag_nodes.py: 独立的 RAG 检索节点 - 从 react_nodes.py 移除 RAG 相关代码 - 更新导入和导出 - rag_nodes.py 包含 rag_retrieve_node 和 rag_re_retrieve_node - 添加 inject_rag_tool_to_state 工具函数
74 lines
1.5 KiB
Python
74 lines
1.5 KiB
Python
"""
|
|
Graph 子模块 - React 模式增强版(带超时重试)
|
|
"""
|
|
|
|
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
|
|
)
|
|
|
|
__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"
|
|
]
|