2023-10-18 15:19:02 +08:00
|
|
|
|
from langchain.tools import Tool
|
|
|
|
|
|
from server.agent.tools import *
|
2023-10-21 22:09:53 +08:00
|
|
|
|
|
|
|
|
|
|
# tools = [
|
|
|
|
|
|
# Tool.from_function(
|
|
|
|
|
|
# func=calculate,
|
|
|
|
|
|
# name="计算器工具",
|
|
|
|
|
|
# description="进行简单的数学运算"
|
|
|
|
|
|
# ),
|
|
|
|
|
|
# Tool.from_function(
|
|
|
|
|
|
# func=translate,
|
|
|
|
|
|
# name="翻译工具",
|
|
|
|
|
|
# description="如果你无法访问互联网,并且需要翻译各种语言,应该使用这个工具"
|
|
|
|
|
|
# ),
|
|
|
|
|
|
# Tool.from_function(
|
|
|
|
|
|
# func=weathercheck,
|
|
|
|
|
|
# name="天气查询工具",
|
|
|
|
|
|
# description="无需访问互联网,使用这个工具查询中国各地未来24小时的天气",
|
|
|
|
|
|
# ),
|
|
|
|
|
|
# Tool.from_function(
|
|
|
|
|
|
# func=shell,
|
|
|
|
|
|
# name="shell工具",
|
|
|
|
|
|
# description="使用命令行工具输出",
|
|
|
|
|
|
# ),
|
|
|
|
|
|
# Tool.from_function(
|
|
|
|
|
|
# func=knowledge_search_more,
|
|
|
|
|
|
# name="知识库查询工具",
|
|
|
|
|
|
# description="优先访问知识库来获取答案",
|
|
|
|
|
|
# ),
|
|
|
|
|
|
# Tool.from_function(
|
|
|
|
|
|
# func=search_internet,
|
|
|
|
|
|
# name="互联网查询工具",
|
|
|
|
|
|
# description="如果你无法访问互联网,这个工具可以帮助你访问Bing互联网来解答问题",
|
|
|
|
|
|
# ),
|
|
|
|
|
|
# ]
|
|
|
|
|
|
|
|
|
|
|
|
## 请注意,如果你是为了使用AgentLM,在这里,你应该使用英文版本,下面的内容是英文版本。
|
2023-09-17 11:19:16 +08:00
|
|
|
|
tools = [
|
|
|
|
|
|
Tool.from_function(
|
|
|
|
|
|
func=calculate,
|
2023-10-21 22:09:53 +08:00
|
|
|
|
name="Calculator Tool",
|
|
|
|
|
|
description="Perform simple mathematical operations"
|
2023-09-17 11:19:16 +08:00
|
|
|
|
),
|
|
|
|
|
|
Tool.from_function(
|
|
|
|
|
|
func=translate,
|
2023-10-21 22:09:53 +08:00
|
|
|
|
name="Translation Tool",
|
|
|
|
|
|
description="Use this tool if you can't access the internet and need to translate various languages"
|
2023-09-17 11:19:16 +08:00
|
|
|
|
),
|
|
|
|
|
|
Tool.from_function(
|
|
|
|
|
|
func=weathercheck,
|
2023-10-21 22:09:53 +08:00
|
|
|
|
name="Weather Checking Tool",
|
|
|
|
|
|
description="Check the weather for various places in China for the next 24 hours without needing internet access"
|
2023-09-28 20:19:26 +08:00
|
|
|
|
),
|
|
|
|
|
|
Tool.from_function(
|
|
|
|
|
|
func=shell,
|
2023-10-21 22:09:53 +08:00
|
|
|
|
name="Shell Tool",
|
|
|
|
|
|
description="Use command line tool output"
|
2023-09-28 20:19:26 +08:00
|
|
|
|
),
|
|
|
|
|
|
Tool.from_function(
|
2023-10-18 15:19:02 +08:00
|
|
|
|
func=knowledge_search_more,
|
2023-10-22 00:00:15 +08:00
|
|
|
|
name="Knowledge Base Tool",
|
2023-10-21 22:09:53 +08:00
|
|
|
|
description="Prioritize accessing the knowledge base to get answers"
|
2023-10-04 12:05:46 +08:00
|
|
|
|
),
|
|
|
|
|
|
Tool.from_function(
|
|
|
|
|
|
func=search_internet,
|
2023-10-22 00:00:15 +08:00
|
|
|
|
name="Internet Tool",
|
2023-10-21 22:09:53 +08:00
|
|
|
|
description="If you can't access the internet, this tool can help you access Bing to answer questions"
|
2023-10-04 12:05:46 +08:00
|
|
|
|
),
|
2023-09-17 11:19:16 +08:00
|
|
|
|
]
|
2023-10-18 15:19:02 +08:00
|
|
|
|
|
2023-09-17 11:19:16 +08:00
|
|
|
|
tool_names = [tool.name for tool in tools]
|