AskNewsAPIWrapper#

class langchain_community.utilities.asknews.AskNewsAPIWrapper[source]#

Bases: BaseModel

Wrapper for AskNews API.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

param asknews_client_id: str | None = None#

Client ID for the AskNews API.

param asknews_client_secret: str | None = None#

Client Secret for the AskNews API.

async asearch_news(query: str, max_results: int = 10, hours_back: int = 0) str[source]#

Search news in AskNews API asynchronously.

Parameters:
  • query (str)

  • max_results (int)

  • hours_back (int)

Return type:

str

search_news(query: str, max_results: int = 10, hours_back: int = 0) str[source]#

Search news in AskNews API synchronously.

Parameters:
  • query (str)

  • max_results (int)

  • hours_back (int)

Return type:

str