先决条件
以下示例需要google-search-results 库以及来自 SerpApi 的 API 密钥。
示例
下面的 Agent 将在 Google 上搜索查询:“美国正在发生什么”并分享结果。cookbook/tools/serpapi_tools.py
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
google-search-results 库以及来自 SerpApi 的 API 密钥。
pip install -U google-search-results
export SERP_API_KEY=***
from agno.agent import Agent
from agno.tools.serpapi import SerpApiTools
agent = Agent(tools=[SerpApiTools()])
agent.print_response("Whats happening in the USA?", markdown=True)
| 参数 | 类型 | 默认值 | 描述 |
|---|---|---|---|
api_key | str | - | 用于身份验证的 API 密钥。 |
search_youtube | bool | False | 启用在 YouTube 上搜索内容的功能。 |
| 函数 | 描述 |
|---|---|
search_google | 此函数会在 Google 上搜索查询。 |
search_youtube | 在 YouTube 上搜索查询。 |