Newspaper4k 使 Agent 能够使用 Newspaper4k 库阅读新闻文章。
先决条件
以下示例需要 newspaper4k
和 lxml_html_clean
库。
pip install -U newspaper4k lxml_html_clean
实战示例
以下 Agent 将总结文章:https://www.rockymountaineer.com/blog/experience-icefields-parkway-scenic-drive-lifetime。
cookbook/tools/newspaper4k_tools.py
from agno.agent import Agent
from agno.tools.newspaper4k import Newspaper4kTools
agent = Agent(tools=[Newspaper4kTools()], debug_mode=True, show_tool_calls=True)
agent.print_response("Please summarize https://www.rockymountaineer.com/blog/experience-icefields-parkway-scenic-drive-lifetime")
参数 | 类型 | 默认值 | 描述 |
---|
read_article | bool | True | 启用读取文章全文的功能。 |
include_summary | bool | False | 指定是否在返回全文的同时包含文章的摘要。 |
article_length | int | - | 要处理或返回的文章或其摘要的最大长度。 |
函数 | 描述 |
---|
get_article_data | 此函数读取文章的全文和数据。 |
read_article | 此函数读取文章的全文。 |
开发者资源
Responses are generated using AI and may contain mistakes.