"""企业业务工具""" from langchain_core.tools import tool # ================================ # 工具1:查询订单系统 # ================================ @tool def query_order(order_id: str) -> str: """查询订单系统""" orders = { "10001": { "status": "运输中", "company": "顺丰", "days": 2, }, "10002": { "status": "已退款", "company": "", "days": 0, }, } return orders.get( order_id, "没有找到订单", ) # ================================ # 工具2:查询商品知识库 # ================================ @tool def query_product(product_name: str) -> str: """查询商品知识库""" products = { "无线耳机": { "category": "电子产品", "price": "299元", "warranty": "1年", }, "机械键盘": { "category": "电脑外设", "price": "599元", "warranty": "2年", }, } return products.get( product_name, "没有找到该商品信息", ) tools = [ query_order, query_product ]