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.

from_params(places, *[, openweathermap_api_key])

lazy_load()

Lazily load weather data for the given locations.

load()

Load weather data for the given locations.

load_and_split([text_splitter])

Load Documents and split into chunks.

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

Initialize with parameters.

classmethod from_params(places: Sequence[str], *, openweathermap_api_key: Optional[str] = None) WeatherDataLoader[source]¶
lazy_load() Iterator[Document][source]¶

Lazily load weather data for the given locations.

load() List[Document][source]¶

Load weather data for the given locations.

load_and_split(text_splitter: Optional[TextSplitter] = None) List[Document]¶

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

Parameters

text_splitter – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.

Returns

List of Documents.

Examples using WeatherDataLoader¶