feat: 实现 React 模式循环推理,带超时重试和结构化错误处理
Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Failing after 6m15s
Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Failing after 6m15s
- 更新 intent.py 为 React 模式推理器 - 新增 react_nodes.py: React 模式节点 - 新增 retry_utils.py: 超时和重试工具 - 更新 state.py: 支持循环步数和错误记录 - 重写 subgraph_builder.py: 完整 React 循环流程 - 结构化错误输出,符合 Agent 执行循环最佳实践 - 限制最大推理步数 ≤40,防止无限循环 - RAG 检索带重试和超时保护 - 子图错误可传递给主图处理
This commit is contained in:
@@ -17,6 +17,7 @@ from .formatter import (
|
||||
)
|
||||
|
||||
from .intent import (
|
||||
# 旧版 API(保持向后兼容)
|
||||
IntentType,
|
||||
Intent,
|
||||
Entity,
|
||||
@@ -24,7 +25,17 @@ from .intent import (
|
||||
RuleBasedIntentClassifier,
|
||||
RuleBasedEntityExtractor,
|
||||
IntentRegistry,
|
||||
create_default_intent_parser
|
||||
create_default_intent_parser,
|
||||
# 新版 React 模式 API
|
||||
ReasoningAction,
|
||||
RetrievalConfig,
|
||||
ReasoningResult,
|
||||
BaseIntentReasoner,
|
||||
RuleBasedReactReasoner,
|
||||
LLMReactReasoner,
|
||||
create_react_reasoner,
|
||||
react_reason,
|
||||
get_route_by_reasoning
|
||||
)
|
||||
|
||||
from .human_review import (
|
||||
@@ -49,7 +60,7 @@ __all__ = [
|
||||
"TemplateManager",
|
||||
"OutputRenderer",
|
||||
"PresetTemplates",
|
||||
# intent
|
||||
# intent - 旧版
|
||||
"IntentType",
|
||||
"Intent",
|
||||
"Entity",
|
||||
@@ -58,6 +69,16 @@ __all__ = [
|
||||
"RuleBasedEntityExtractor",
|
||||
"IntentRegistry",
|
||||
"create_default_intent_parser",
|
||||
# intent - 新版 React 模式
|
||||
"ReasoningAction",
|
||||
"RetrievalConfig",
|
||||
"ReasoningResult",
|
||||
"BaseIntentReasoner",
|
||||
"RuleBasedReactReasoner",
|
||||
"LLMReactReasoner",
|
||||
"create_react_reasoner",
|
||||
"react_reason",
|
||||
"get_route_by_reasoning",
|
||||
# human_review
|
||||
"ReviewStatus",
|
||||
"HumanReview",
|
||||
|
||||
Reference in New Issue
Block a user