mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-01-26 08:43:23 +08:00
* 修复Azure 不设置Max token的bug * 重写agent 1. 修改Agent实现方式,支持多参数,仅剩 ChatGLM3-6b和 OpenAI GPT4 支持,剩余模型将在暂时缺席Agent功能 2. 删除agent_chat 集成到llm_chat中 3. 重写大部分工具,适应新Agent * 更新架构 * 删除web_chat,自动融合 * 移除所有聊天,都变成Agent控制 * 更新配置文件 * 更新配置模板和提示词 * 更改参数选择bug
60 lines
2.1 KiB
Python
60 lines
2.1 KiB
Python
from langchain_core.tools import StructuredTool
|
||
from server.agent.tools_factory import *
|
||
from configs import KB_INFO
|
||
|
||
template = "Use local knowledgebase from one or more of these:\n{KB_info}\n to get information,Only local data on this knowledge use this tool."
|
||
KB_info_str = '\n'.join([f"{key}: {value}" for key, value in KB_INFO.items()])
|
||
template_knowledge = template.format(KB_info=KB_info_str)
|
||
|
||
all_tools = [
|
||
StructuredTool.from_function(
|
||
func=calculate,
|
||
name="calculate",
|
||
description="Useful for when you need to answer questions about simple calculations",
|
||
args_schema=CalculatorInput,
|
||
),
|
||
StructuredTool.from_function(
|
||
func=arxiv,
|
||
name="arxiv",
|
||
description="A wrapper around Arxiv.org for searching and retrieving scientific articles in various fields.",
|
||
args_schema=ArxivInput,
|
||
),
|
||
StructuredTool.from_function(
|
||
func=shell,
|
||
name="shell",
|
||
description="Use Shell to execute Linux commands",
|
||
args_schema=ShellInput,
|
||
),
|
||
StructuredTool.from_function(
|
||
func=wolfram,
|
||
name="wolfram",
|
||
description="Useful for when you need to calculate difficult formulas",
|
||
args_schema=WolframInput,
|
||
),
|
||
StructuredTool.from_function(
|
||
func=search_youtube,
|
||
name="search_youtube",
|
||
description="use this tools_factory to search youtube videos",
|
||
args_schema=YoutubeInput,
|
||
),
|
||
StructuredTool.from_function(
|
||
func=weather_check,
|
||
name="weather_check",
|
||
description="Use this tool to check the weather at a specific location",
|
||
args_schema=WeatherInput,
|
||
),
|
||
StructuredTool.from_function(
|
||
func=search_internet,
|
||
name="search_internet",
|
||
description="Use this tool to use bing search engine to search the internet and get information",
|
||
args_schema=SearchInternetInput,
|
||
),
|
||
StructuredTool.from_function(
|
||
func=search_local_knowledgebase,
|
||
name="search_local_knowledgebase",
|
||
description=template_knowledge,
|
||
args_schema=SearchKnowledgeInput,
|
||
),
|
||
]
|
||
|