WeatherDataLoader#

class langchain_community.document_loaders.weather.WeatherDataLoader(client: OpenWeatherMapAPIWrapper, places: Sequence[str])[source]#

Load weather data with Open Weather Map API.

Reads the forecast & current weather of any location using OpenWeatherMap’s free API. Checkout ‘https://openweathermap.org/appid’ for more on how to generate a free OpenWeatherMap API.

Initialize with parameters.

Methods

__init__(client, places)

Initialize with parameters.

alazy_load()

A lazy loader for Documents.

aload()

Load data into Document objects.

from_params(places, *[, openweathermap_api_key])

lazy_load()

Lazily load weather data for the given locations.

load()

Load data into Document objects.

load_and_split([text_splitter])

Load Documents and split into chunks.

Parameters:
__init__(client: OpenWeatherMapAPIWrapper, places: Sequence[str]) None[source]#

Initialize with parameters.

Parameters:
Return type:

None

async alazy_load() AsyncIterator[Document]#

A lazy loader for Documents.

Return type:

AsyncIterator[Document]

async aload() list[Document]#

Load data into Document objects.

Return type:

list[Document]

classmethod from_params(places: Sequence[str], *, openweathermap_api_key: str | None = None) WeatherDataLoader[source]#
Parameters:
  • places (Sequence[str])

  • openweathermap_api_key (str | None)

Return type:

WeatherDataLoader

lazy_load() Iterator[Document][source]#

Lazily load weather data for the given locations.

Return type:

Iterator[Document]

load() list[Document]#

Load data into Document objects.

Return type:

list[Document]

load_and_split(text_splitter: TextSplitter | None = None) list[Document]#

Load Documents and split into chunks. Chunks are returned as Documents.

Do not override this method. It should be considered to be deprecated!

Parameters:

text_splitter (Optional[TextSplitter]) – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.

Returns:

List of Documents.

Return type:

list[Document]

Examples using WeatherDataLoader