langchain_community.document_loaders.weather.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.

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]

classmethod from_params(places: Sequence[str], *, openweathermap_api_key: Optional[str] = None) WeatherDataLoader[source]¶
Parameters
  • places (Sequence[str]) –

  • openweathermap_api_key (Optional[str]) –

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: Optional[TextSplitter] = 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¶