Newspaper4k enable an Assistant to read news articles using the Newspaper4k library.

Example

The following assistant will summarize the article: ”https://www.rockymountaineer.com/blog/experience-icefields-parkway-scenic-drive-lifetime“.

cookbook/tools/newspaper4k_tools.py
from phi.assistant import Assistant
from phi.tools.newspaper4k import Newspaper4k

assistant = Assistant(tools=[Newspaper4k()], debug_mode=True, show_tool_calls=True)
assistant.print_response(
    "https://www.rockymountaineer.com/blog/experience-icefields-parkway-scenic-drive-lifetime",
    markdown=True,
)

Toolkit Params

read_article
bool
default: "True"

Enables the functionality to read the full content of an article.

include_summary
bool
default: "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

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.