Rimossi TODO e Aggiunto documentazione per metodi aggregated

This commit is contained in:
2025-10-04 01:28:16 +02:00
parent cc3a56cb6d
commit 42ec2e6eef
5 changed files with 22 additions and 4 deletions

View File

@@ -59,6 +59,8 @@ class NewsAPIsTool(NewsWrapper, Toolkit):
limit (int): Maximum number of articles to retrieve from each provider.
Returns:
dict[str, list[Article]]: A dictionary mapping providers names to their list of Articles
Raises:
Exception: If all wrappers fail to provide results.
"""
return self.wrapper_handler.try_call_all(lambda w: w.get_top_headlines(limit))
@@ -70,5 +72,7 @@ class NewsAPIsTool(NewsWrapper, Toolkit):
limit (int): Maximum number of articles to retrieve from each provider.
Returns:
dict[str, list[Article]]: A dictionary mapping providers names to their list of Articles
Raises:
Exception: If all wrappers fail to provide results.
"""
return self.wrapper_handler.try_call_all(lambda w: w.get_latest_news(query, limit))

View File

@@ -24,7 +24,7 @@ class NewsApiWrapper(NewsWrapper):
self.client = newsapi.NewsApiClient(api_key=api_key)
self.category = "business" # Cryptocurrency is under business
self.language = "en" # TODO Only English articles for now?
self.language = "en"
self.max_page_size = 100
def __calc_pages(self, limit: int, page_size: int) -> tuple[int, int]: