package agent import ( "context" "eino-project/internal/domain/llm" "eino-project/internal/domain/tools" "github.com/cloudwego/eino/adk" "github.com/cloudwego/eino/components/tool" "github.com/cloudwego/eino/compose" ) // NewOrderChatAgent 订单查询 Agent,具备订单查询与日志查询工具 func NewOrderChatAgent(ctx context.Context, models llm.LLM) adk.Agent { chatModel, err := models.Intent() if err != nil { return nil } toolsCfg := adk.ToolsConfig{ ToolsNodeConfig: compose.ToolsNodeConfig{ Tools: []tool.BaseTool{ tools.NewOrderByIDTool(), }, ExecuteSequentially: false, }, ReturnDirectly: map[string]bool{ "get_order_by_id": true, }, } agent, _ := adk.NewChatModelAgent(ctx, &adk.ChatModelAgentConfig{ Name: "订单查询智能体", Description: "支持按订单ID查询订单详情", Model: chatModel, ToolsConfig: toolsCfg, Instruction: ` # 你是订单查询智能体 - 当用户给出订单ID时,优先调用 "get_order_by_id" 返回订单详情 - 仅返回订单详情json即可,不做多余解释 `, }) return agent }