NewspaperTools 支持 Agent 使用 Newspaper4k 库阅读新闻文章。

前置条件

以下示例需要 newspaper3k 库。

pip install -U newspaper3k

示例

下面的 Agent 将总结维基百科关于语言模型的文章。

cookbook/tools/newspaper_tools.py
from agno.agent import Agent
from agno.tools.newspaper import NewspaperTools

agent = Agent(tools=[NewspaperTools()])
agent.print_response("Please summarize https://en.wikipedia.org/wiki/Language_model")

Toolkit 参数

参数类型默认值描述
get_article_textboolTrue启用检索文章文本的功能。

Toolkit 函数

函数描述
get_article_text从指定的 URL 检索文章文本。参数包括文章的 URL url。返回文章文本或检索失败时的错误消息。

开发者资源