From 92202e0f9803fdaa5304e1dcb676639ecd9fb109 Mon Sep 17 00:00:00 2001 From: weiweiw <14335254+weiweiw22@user.noreply.gitee.com> Date: Mon, 24 Feb 2025 10:35:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E4=B8=8D=E7=94=A8=E7=9A=84to?= =?UTF-8?q?ol?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chatchat/server/agent/tools_factory/amap_poi_search.py | 2 +- .../chatchat/server/agent/tools_factory/amap_weather.py | 2 +- .../chatchat/server/agent/tools_factory/arxiv.py | 2 +- .../chatchat/server/agent/tools_factory/calculate.py | 2 +- .../chatchat/server/agent/tools_factory/search_internet.py | 2 +- .../server/agent/tools_factory/search_local_knowledgebase.py | 4 ++-- .../chatchat/server/agent/tools_factory/search_youtube.py | 2 +- .../chatchat/server/agent/tools_factory/shell.py | 2 +- .../chatchat/server/agent/tools_factory/text2image.py | 2 +- .../chatchat/server/agent/tools_factory/text2promql.py | 2 +- .../chatchat/server/agent/tools_factory/text2sql.py | 2 +- .../chatchat/server/agent/tools_factory/url_reader.py | 2 +- .../chatchat/server/agent/tools_factory/weather_check.py | 2 +- .../chatchat/server/agent/tools_factory/wikipedia_search.py | 2 +- .../chatchat/server/agent/tools_factory/wolfram.py | 2 +- 15 files changed, 16 insertions(+), 16 deletions(-) diff --git a/libs/chatchat-server/chatchat/server/agent/tools_factory/amap_poi_search.py b/libs/chatchat-server/chatchat/server/agent/tools_factory/amap_poi_search.py index d9b260a..de10c1b 100644 --- a/libs/chatchat-server/chatchat/server/agent/tools_factory/amap_poi_search.py +++ b/libs/chatchat-server/chatchat/server/agent/tools_factory/amap_poi_search.py @@ -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.""" diff --git a/libs/chatchat-server/chatchat/server/agent/tools_factory/amap_weather.py b/libs/chatchat-server/chatchat/server/agent/tools_factory/amap_weather.py index 48573d4..d0476b3 100644 --- a/libs/chatchat-server/chatchat/server/agent/tools_factory/amap_weather.py +++ b/libs/chatchat-server/chatchat/server/agent/tools_factory/amap_weather.py @@ -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") diff --git a/libs/chatchat-server/chatchat/server/agent/tools_factory/arxiv.py b/libs/chatchat-server/chatchat/server/agent/tools_factory/arxiv.py index cc83ade..1ddc053 100644 --- a/libs/chatchat-server/chatchat/server/agent/tools_factory/arxiv.py +++ b/libs/chatchat-server/chatchat/server/agent/tools_factory/arxiv.py @@ -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 diff --git a/libs/chatchat-server/chatchat/server/agent/tools_factory/calculate.py b/libs/chatchat-server/chatchat/server/agent/tools_factory/calculate.py index fdf7733..c57e9b2 100644 --- a/libs/chatchat-server/chatchat/server/agent/tools_factory/calculate.py +++ b/libs/chatchat-server/chatchat/server/agent/tools_factory/calculate.py @@ -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. diff --git a/libs/chatchat-server/chatchat/server/agent/tools_factory/search_internet.py b/libs/chatchat-server/chatchat/server/agent/tools_factory/search_internet.py index 41acf55..18a9231 100644 --- a/libs/chatchat-server/chatchat/server/agent/tools_factory/search_internet.py +++ b/libs/chatchat-server/chatchat/server/agent/tools_factory/search_internet.py @@ -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) diff --git a/libs/chatchat-server/chatchat/server/agent/tools_factory/search_local_knowledgebase.py b/libs/chatchat-server/chatchat/server/agent/tools_factory/search_local_knowledgebase.py index cf5a371..b3a984a 100644 --- a/libs/chatchat-server/chatchat/server/agent/tools_factory/search_local_knowledgebase.py +++ b/libs/chatchat-server/chatchat/server/agent/tools_factory/search_local_knowledgebase.py @@ -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) diff --git a/libs/chatchat-server/chatchat/server/agent/tools_factory/search_youtube.py b/libs/chatchat-server/chatchat/server/agent/tools_factory/search_youtube.py index 353be53..82665a2 100644 --- a/libs/chatchat-server/chatchat/server/agent/tools_factory/search_youtube.py +++ b/libs/chatchat-server/chatchat/server/agent/tools_factory/search_youtube.py @@ -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 diff --git a/libs/chatchat-server/chatchat/server/agent/tools_factory/shell.py b/libs/chatchat-server/chatchat/server/agent/tools_factory/shell.py index 34e6f47..fb066d6 100644 --- a/libs/chatchat-server/chatchat/server/agent/tools_factory/shell.py +++ b/libs/chatchat-server/chatchat/server/agent/tools_factory/shell.py @@ -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() diff --git a/libs/chatchat-server/chatchat/server/agent/tools_factory/text2image.py b/libs/chatchat-server/chatchat/server/agent/tools_factory/text2image.py index 3d7833e..be6cfd4 100644 --- a/libs/chatchat-server/chatchat/server/agent/tools_factory/text2image.py +++ b/libs/chatchat-server/chatchat/server/agent/tools_factory/text2image.py @@ -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="需生成图片的数量"), diff --git a/libs/chatchat-server/chatchat/server/agent/tools_factory/text2promql.py b/libs/chatchat-server/chatchat/server/agent/tools_factory/text2promql.py index 09cea27..42548ab 100644 --- a/libs/chatchat-server/chatchat/server/agent/tools_factory/text2promql.py +++ b/libs/chatchat-server/chatchat/server/agent/tools_factory/text2promql.py @@ -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, " diff --git a/libs/chatchat-server/chatchat/server/agent/tools_factory/text2sql.py b/libs/chatchat-server/chatchat/server/agent/tools_factory/text2sql.py index 6303f5f..e765e77 100644 --- a/libs/chatchat-server/chatchat/server/agent/tools_factory/text2sql.py +++ b/libs/chatchat-server/chatchat/server/agent/tools_factory/text2sql.py @@ -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" diff --git a/libs/chatchat-server/chatchat/server/agent/tools_factory/url_reader.py b/libs/chatchat-server/chatchat/server/agent/tools_factory/url_reader.py index b690271..03a1c10 100644 --- a/libs/chatchat-server/chatchat/server/agent/tools_factory/url_reader.py +++ b/libs/chatchat-server/chatchat/server/agent/tools_factory/url_reader.py @@ -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."), diff --git a/libs/chatchat-server/chatchat/server/agent/tools_factory/weather_check.py b/libs/chatchat-server/chatchat/server/agent/tools_factory/weather_check.py index 08d5973..e6ee181 100644 --- a/libs/chatchat-server/chatchat/server/agent/tools_factory/weather_check.py +++ b/libs/chatchat-server/chatchat/server/agent/tools_factory/weather_check.py @@ -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") diff --git a/libs/chatchat-server/chatchat/server/agent/tools_factory/wikipedia_search.py b/libs/chatchat-server/chatchat/server/agent/tools_factory/wikipedia_search.py index bc1519a..534805a 100644 --- a/libs/chatchat-server/chatchat/server/agent/tools_factory/wikipedia_search.py +++ b/libs/chatchat-server/chatchat/server/agent/tools_factory/wikipedia_search.py @@ -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.""" diff --git a/libs/chatchat-server/chatchat/server/agent/tools_factory/wolfram.py b/libs/chatchat-server/chatchat/server/agent/tools_factory/wolfram.py index 7d9dcc8..628d31a 100644 --- a/libs/chatchat-server/chatchat/server/agent/tools_factory/wolfram.py +++ b/libs/chatchat-server/chatchat/server/agent/tools_factory/wolfram.py @@ -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"""