feat:优化增量执行、工具调用容错与评测体系
This commit is contained in:
@@ -10,6 +10,7 @@ from langchain.agents import create_agent
|
||||
from langchain.agents.middleware import ModelCallLimitMiddleware
|
||||
|
||||
from app.agent.data_tools import DATA_TOOLS, DataContext
|
||||
from app.agent.tool_args import normalize_tool_args
|
||||
from app.clients.llm import get_llm
|
||||
from app.config import settings
|
||||
from app.prompt.qa import QA_DATA_RULES, QA_SYSTEM_PROMPT
|
||||
@@ -37,6 +38,8 @@ def get_qa_agent(with_data: bool = False):
|
||||
),
|
||||
context_schema=QAContext,
|
||||
middleware=[
|
||||
# 有工具时才挂参数兼容:挂了 wrap_tool_call 中间件,没有工具也会多出一个工具节点
|
||||
*([normalize_tool_args] if with_data else []),
|
||||
# 超过上限时抛 ModelCallLimitExceededError,由节点按失败处理;
|
||||
# 写成 end 时中间件只插入一条英文说明,节点分不清是正常结束还是用尽了次数
|
||||
ModelCallLimitMiddleware(
|
||||
|
||||
Reference in New Issue
Block a user