mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-01-19 21:37:20 +08:00
* 更新上agent提示词代码 * 更新部分文档,修复了issue中提到的bge匹配超过1 的bug * 按需修改 * 解决了部分最新用户用依赖的bug,加了两个工具,移除google工具 * Agent大幅度优化 1. 修改了UI界面 (1)高亮所有没有进行agent对齐的模型, (2)优化输出体验和逻辑,使用markdown 2. 降低天气工具使用门槛 3. 依赖更新 (1) vllm 更新到0.2.0,增加了一些参数 (2) torch 建议更新到2.1 (3)pydantic不要更新到1.10.12
48 lines
1.6 KiB
Python
48 lines
1.6 KiB
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 server.agent.shell import shell
|
||
from langchain.agents import Tool
|
||
from server.agent.search_knowledge import search_knowledge
|
||
from server.agent.search_internet import search_internet
|
||
|
||
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=search_knowledge,
|
||
name="知识库查询工具",
|
||
description="访问知识库来获取答案",
|
||
),
|
||
Tool.from_function(
|
||
func=search_internet,
|
||
name="互联网查询工具",
|
||
description="如果你无法访问互联网,这个工具可以帮助你访问Bing互联网来解答问题",
|
||
),
|
||
|
||
]
|
||
tool_names = [tool.name for tool in tools]
|