zR 598eb298df
第一版初步agent实现 (#1503)
* 第一版初步agent实现

* 增加steaming参数

* 修改了weather.py

---------

Co-authored-by: zR <zRzRzRzRzRzRzR>
2023-09-17 11:19:16 +08:00

29 lines
672 B
Python

import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from server.agent.math import calculate
from server.agent.translator import translate
from server.agent.weather import weathercheck
from langchain.agents import Tool
tools = [
Tool.from_function(
func=calculate,
name="计算器工具",
description=""
),
Tool.from_function(
func=translate,
name="翻译工具",
description=""
),
Tool.from_function(
func=weathercheck,
name="天气查询工具",
description="",
)
]
tool_names = [tool.name for tool in tools]