Update agent.py
Browse files
agent.py
CHANGED
|
@@ -25,7 +25,7 @@ from supabase.client import Client, create_client
|
|
| 25 |
load_dotenv()
|
| 26 |
|
| 27 |
# ======================
|
| 28 |
-
# 工具定义部分
|
| 29 |
# ======================
|
| 30 |
|
| 31 |
@tool
|
|
@@ -57,8 +57,8 @@ def modulus(a: int, b: int) -> int:
|
|
| 57 |
|
| 58 |
@tool
|
| 59 |
def wiki_search(query: str) -> str:
|
| 60 |
-
"""维基百科搜索: 返回最多
|
| 61 |
-
search_docs = WikipediaLoader(query=query, load_max_docs=
|
| 62 |
# 格式化搜索结果
|
| 63 |
formatted_search_docs = "\n\n---\n\n".join(
|
| 64 |
[
|
|
@@ -69,8 +69,8 @@ def wiki_search(query: str) -> str:
|
|
| 69 |
|
| 70 |
@tool
|
| 71 |
def web_search(query: str) -> str:
|
| 72 |
-
"""网络搜索(Tavily): 返回最多
|
| 73 |
-
search_docs = TavilySearchResults(max_results=
|
| 74 |
# 格式化搜索结果
|
| 75 |
formatted_search_docs = "\n\n---\n\n".join(
|
| 76 |
[
|
|
@@ -81,8 +81,8 @@ def web_search(query: str) -> str:
|
|
| 81 |
|
| 82 |
@tool
|
| 83 |
def arvix_search(query: str) -> str:
|
| 84 |
-
"""学术论文搜索(Arxiv): 返回最多
|
| 85 |
-
search_docs = ArxivLoader(query=query, load_max_docs=
|
| 86 |
# 格式化搜索结果(截取前1000字符)
|
| 87 |
formatted_search_docs = "\n\n---\n\n".join(
|
| 88 |
[
|
|
|
|
| 25 |
load_dotenv()
|
| 26 |
|
| 27 |
# ======================
|
| 28 |
+
# 工具定义部分 加减乘除搜索等
|
| 29 |
# ======================
|
| 30 |
|
| 31 |
@tool
|
|
|
|
| 57 |
|
| 58 |
@tool
|
| 59 |
def wiki_search(query: str) -> str:
|
| 60 |
+
"""维基百科搜索: 返回最多1个相关结果"""
|
| 61 |
+
search_docs = WikipediaLoader(query=query, load_max_docs=1).load()
|
| 62 |
# 格式化搜索结果
|
| 63 |
formatted_search_docs = "\n\n---\n\n".join(
|
| 64 |
[
|
|
|
|
| 69 |
|
| 70 |
@tool
|
| 71 |
def web_search(query: str) -> str:
|
| 72 |
+
"""网络搜索(Tavily): 返回最多1个相关结果"""
|
| 73 |
+
search_docs = TavilySearchResults(max_results=1).invoke(query=query)
|
| 74 |
# 格式化搜索结果
|
| 75 |
formatted_search_docs = "\n\n---\n\n".join(
|
| 76 |
[
|
|
|
|
| 81 |
|
| 82 |
@tool
|
| 83 |
def arvix_search(query: str) -> str:
|
| 84 |
+
"""学术论文搜索(Arxiv): 返回最多1个相关结果"""
|
| 85 |
+
search_docs = ArxivLoader(query=query, load_max_docs=1).load()
|
| 86 |
# 格式化搜索结果(截取前1000字符)
|
| 87 |
formatted_search_docs = "\n\n---\n\n".join(
|
| 88 |
[
|