前提条件
以下示例需要brave-search 库。
示例
cookbook/tools/bravesearch_tools.py
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
brave-search 库。
pip install -U brave-search
export BRAVE_API_KEY=***
from agno.agent import Agent
from agno.tools.bravesearch import BraveSearchTools
agent = Agent(
tools=[BraveSearchTools()],
description="你是一个新闻助手,帮助用户找到最新新闻。",
instructions=[
"根据用户提供的主题,回应该主题的 4 条最新新闻。"
],
show_tool_calls=True,
)
agent.print_response("AI 代理", markdown=True)
| 参数 | 类型 | 默认值 | 描述 |
|---|---|---|---|
fixed_max_results | int | None | 可选的固定最大返回结果数。 |
fixed_language | str | None | 可选的固定请求语言。 |
| 函数 | 描述 |
|---|---|
brave_search | 使用 Brave 搜索指定查询。参数包括用于搜索词的 query,用于最大结果数的 max_results(默认为 5),用于搜索结果地理区域的 country(默认为 “US”)以及用于搜索结果语言的 language(默认为 “en”)。将搜索结果以 JSON 格式字符串形式返回。 |