示例
Searxng 使 Agent 能够搜索网络进行查询、抓取网站或爬取网站。cookbook/tools/searxng_tools.py
from agno.agent import Agent
from agno.tools.searxng import SearxngTools
# 使用你的 Searxng 实例 URL 初始化 Searxng
searxng = SearxngTools(
host="http://localhost:53153",
engines=[],
fixed_max_results=5,
news=True,
science=True
)
# 使用 Searxng 创建一个 Agent
agent = Agent(tools=[searxng])
# 示例:让 Agent 使用 Searxng 进行搜索
agent.print_response("""
请搜索关于人工智能的信息,
并总结主要结果中的关键点。
""")
Toolkit 参数
| 参数 | 类型 | 默认值 | 描述 |
|---|---|---|---|
host | str | - | 连接的主机。 |
engines | List[str] | [] | 要使用的搜索引擎列表。 |
fixed_max_results | int | None | 指定固定最大结果数的可选参数。 |
images | bool | False | 启用图片搜索。 |
it | bool | False | 启用 IT 相关内容搜索。 |
map | bool | False | 启用地图搜索。 |
music | bool | False | 启用音乐搜索。 |
news | bool | False | 启用新闻搜索。 |
science | bool | False | 启用科学相关内容搜索。 |
videos | bool | False | 启用视频搜索。 |
Toolkit 函数
| 函数 | 描述 |
|---|---|
search | 使用指定的查询执行常规网络搜索。参数包括搜索词的 query 和结果最大数的 max_results(默认为 5)。返回搜索结果。 |
image_search | 使用指定的查询执行图片搜索。参数包括搜索词的 query 和结果最大数的 max_results(默认为 5)。返回图片搜索结果。 |
it_search | 使用指定的查询执行 IT 相关信息搜索。参数包括搜索词的 query 和结果最大数的 max_results(默认为 5)。返回 IT 相关搜索结果。 |
map_search | 使用指定的查询执行地图搜索。参数包括搜索词的 query 和结果最大数的 max_results(默认为 5)。返回地图搜索结果。 |
music_search | 使用指定的查询执行音乐相关信息搜索。参数包括搜索词的 query 和结果最大数的 max_results(默认为 5)。返回音乐搜索结果。 |
news_search | 使用指定的查询执行新闻搜索。参数包括搜索词的 query 和结果最大数的 max_results(默认为 5)。返回新闻搜索结果。 |
science_search | 使用指定的查询执行科学相关信息搜索。参数包括搜索词的 query 和结果最大数的 max_results(默认为 5)。返回科学相关搜索结果。 |
video_search | 使用指定的查询执行视频搜索。参数包括搜索词的 query 和结果最大数的 max_results(默认为 5)。返回视频搜索结果。 |