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 检索带重试和超时保护 - 子图错误可传递给主图处理
95 lines
1.8 KiB
Python
95 lines
1.8 KiB
Python
"""
|
||
公共工具模块
|
||
提供可复用的基础组件
|
||
|
||
导出:
|
||
- formatter.py: 格式化输出工具
|
||
- intent.py: 意图理解工具
|
||
- human_review.py: 人工审核工具
|
||
- state_base.py: 状态基类工具
|
||
"""
|
||
|
||
from .formatter import (
|
||
MarkdownFormatter,
|
||
TemplateManager,
|
||
OutputRenderer,
|
||
PresetTemplates
|
||
)
|
||
|
||
from .intent import (
|
||
# 旧版 API(保持向后兼容)
|
||
IntentType,
|
||
Intent,
|
||
Entity,
|
||
IntentParser,
|
||
RuleBasedIntentClassifier,
|
||
RuleBasedEntityExtractor,
|
||
IntentRegistry,
|
||
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 (
|
||
ReviewStatus,
|
||
HumanReview,
|
||
HumanReviewStore,
|
||
InMemoryReviewStore,
|
||
HumanReviewNode,
|
||
ReviewManager
|
||
)
|
||
|
||
from .state_base import (
|
||
BaseState,
|
||
Phase,
|
||
TokenUsage,
|
||
StateUtils
|
||
)
|
||
|
||
__all__ = [
|
||
# formatter
|
||
"MarkdownFormatter",
|
||
"TemplateManager",
|
||
"OutputRenderer",
|
||
"PresetTemplates",
|
||
# intent - 旧版
|
||
"IntentType",
|
||
"Intent",
|
||
"Entity",
|
||
"IntentParser",
|
||
"RuleBasedIntentClassifier",
|
||
"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",
|
||
"HumanReviewStore",
|
||
"InMemoryReviewStore",
|
||
"HumanReviewNode",
|
||
"ReviewManager",
|
||
# state_base
|
||
"BaseState",
|
||
"Phase",
|
||
"TokenUsage",
|
||
"StateUtils"
|
||
]
|