去掉不用的tool

This commit is contained in:
weiweiw 2025-02-24 10:35:45 +08:00
parent 194437a271
commit 92202e0f98
15 changed files with 16 additions and 16 deletions

View File

@ -20,7 +20,7 @@ def amap_poi_search_engine(keywords: str,types: str,config: dict):
@regist_tool(title="高德地图POI搜索")
#@regist_tool(title="高德地图POI搜索")
def amap_poi_search(location: str = Field(description="'实际地名'或者'具体的地址',不能使用简称或者别称"),
types: str = Field(description="POI类型比如商场、学校、医院等等")):
""" A wrapper that uses Amap to search."""

View File

@ -36,7 +36,7 @@ def get_weather(adcode: str, config: dict) -> dict:
else:
return {"error": "API request failed"}
@regist_tool(title="高德地图天气查询")
#@regist_tool(title="高德地图天气查询")
def amap_weather(city: str = Field(description="城市名")):
"""A wrapper that uses Amap to get weather information."""
tool_config = get_tool_config("amap")

View File

@ -4,7 +4,7 @@ from chatchat.server.pydantic_v1 import Field
from .tools_registry import BaseToolOutput, regist_tool
@regist_tool(title="ARXIV论文")
#@regist_tool(title="ARXIV论文")
def arxiv(query: str = Field(description="The search query title")):
"""A wrapper around Arxiv.org for searching and retrieving scientific articles in various fields."""
from langchain.tools.arxiv.tool import ArxivQueryRun

View File

@ -3,7 +3,7 @@ from chatchat.server.pydantic_v1 import Field
from .tools_registry import BaseToolOutput, regist_tool
@regist_tool(title="数学计算器")
#@regist_tool(title="数学计算器")
def calculate(text: str = Field(description="a math expression")) -> float:
"""
Useful to answer questions about simple calculations.

View File

@ -123,6 +123,6 @@ def search_engine(query: str, top_k:int=0, engine_name: str="", config: dict={})
@regist_tool(title="互联网搜索")
def search_internet(query: str = Field(description="query for Internet search")):
"""Use this tool to use bing search engine to search the internet and get information."""
"""用这个工具实现获取世界、历史、实时新闻、或除电力系统之外的信息查询"""
print(f"search_internet: query: {query}")
return BaseToolOutput(search_engine(query=query), format=format_context)

View File

@ -16,7 +16,7 @@ from chatchat.server.utils import get_tool_config
# "this knowledge use this tool. The 'database' should be one of the above [{key}]."
# )
template = (
"使用本地知识库里\n{KB_info}\n查国家电网各部门规章制度、安徽送变电规章制度等相关的问题时,只有当用户的问题在本地知识库里时才使用这个工具查询"
"使用本地知识库里\n{KB_info}\n查国家电网各部门规章制度、安徽送变电规章制度等相关的特定问题时,只有当用户的问题在本地知识库里时才使用这个工具查询"
"'database' 应该是上面的 [{key}] 之一."
)
KB_info_str = "\n".join([f"{key}: {value}" for key, value in Settings.kb_settings.KB_INFO.items()])
@ -44,7 +44,7 @@ def search_local_knowledgebase(
),
query: str = Field(description="Query for Knowledge Search"),
):
""""""
"""用这个工具实现国家电网各部门规章制度、安徽送变电规章制度等特定的相关问题,需要通过知识库来回答"""
tool_config = get_tool_config("search_local_knowledgebase")
ret = search_knowledgebase(query=query, database=database, config=tool_config)
return BaseToolOutput(ret, format=format_context)

View File

@ -3,7 +3,7 @@ from chatchat.server.pydantic_v1 import Field
from .tools_registry import BaseToolOutput, regist_tool
@regist_tool(title="油管视频")
#@regist_tool(title="油管视频")
def search_youtube(query: str = Field(description="Query for Videos search")):
"""use this tools_factory to search youtube videos"""
from langchain_community.tools import YouTubeSearchTool

View File

@ -6,7 +6,7 @@ from chatchat.server.pydantic_v1 import Field
from .tools_registry import BaseToolOutput, regist_tool
@regist_tool(title="系统命令")
#@regist_tool(title="系统命令")
def shell(query: str = Field(description="The command to execute")):
"""Use Shell to execute system shell commands"""
tool = ShellTool()

View File

@ -14,7 +14,7 @@ from chatchat.server.utils import MsgType, get_tool_config, get_model_info
from .tools_registry import BaseToolOutput, regist_tool
@regist_tool(title="文生图", return_direct=True)
#@regist_tool(title="文生图", return_direct=True)
def text2images(
prompt: str,
n: int = Field(1, description="需生成图片的数量"),

View File

@ -108,7 +108,7 @@ def query_prometheus(query: str, config: dict) -> str:
return content
@regist_tool(title="Prometheus对话")
#@regist_tool(title="Prometheus对话")
def text2promql(
query: str = Field(
description="Tool for querying a Prometheus server, No need for PromQL statements, "

View File

@ -129,7 +129,7 @@ def query_database(query: str, config: dict):
return context
@regist_tool(title="数据库对话")
#@regist_tool(title="数据库对话")
def text2sql(
query: str = Field(
description="No need for SQL statements,just input the natural language that you want to chat with database"

View File

@ -13,7 +13,7 @@ from chatchat.server.agent.tools_factory.tools_registry import format_context
from .tools_registry import BaseToolOutput, regist_tool
@regist_tool(title="URL内容阅读")
#@regist_tool(title="URL内容阅读")
def url_reader(
url: str = Field(
description="The URL to be processed, so that its web content can be made more clear to read. Then provide a detailed description of the content in about 500 words. As structured as possible. ONLY THE LINK SHOULD BE PASSED IN."),

View File

@ -14,7 +14,7 @@ from .tools_registry import BaseToolOutput, regist_tool
def weather_check(
city: str = Field(description="City name,include city and county,like '厦门'"),
):
"""Use this tool to check the weather at a specific city"""
"""用这个工具获取指定地点和指定时间的天气"""
print(f"weather_check tool内部调用city{city}")
tool_config = get_tool_config("weather_check")

View File

@ -8,7 +8,7 @@ from chatchat.server.pydantic_v1 import Field
from .tools_registry import BaseToolOutput, regist_tool
@regist_tool(title="维基百科搜索")
#@regist_tool(title="维基百科搜索")
def wikipedia_search(query: str = Field(description="The search query")):
""" A wrapper that uses Wikipedia to search."""

View File

@ -6,7 +6,7 @@ from chatchat.server.utils import get_tool_config
from .tools_registry import BaseToolOutput, regist_tool
@regist_tool
#@regist_tool
def wolfram(query: str = Field(description="The formula to be calculated")):
"""Useful for when you need to calculate difficult formulas"""