Newspaper4k
Newspaper4k enables an Agent to read news articles using the Newspaper4k library.
Prerequisites
The following example requires the newspaper4k and lxml_html_clean libraries.
1uv pip install -U newspaper4k lxml_html_cleanExample
The following agent will summarize the article: https://www.rockymountaineer.com/blog/experience-icefields-parkway-scenic-drive-lifetime.
1from kern.agent import Agent2from kern.tools.newspaper4k import Newspaper4kTools34agent = Agent(tools=[Newspaper4kTools()], debug_mode=True)5agent.print_response("Please summarize https://www.rockymountaineer.com/blog/experience-icefields-parkway-scenic-drive-lifetime")Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
enable_read_article | bool | True | Enables the functionality to read the full content of an article. |
include_summary | bool | False | Specifies whether to include a summary of the article along with the full content. |
article_length | int | - | The maximum length of the article or its summary to be processed or returned. |
Toolkit Functions
| Function | Description |
|---|---|
get_article_data | This function reads the full content and data of an article. |
read_article | This function reads the full content of an article. |
Developer Resources
- View Tools