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.
A lazy loader for Documents.
aload
()Load data into Document objects.
from_params
(places, *[, openweathermap_api_key])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:
client (OpenWeatherMapAPIWrapper)
places (Sequence[str])
- __init__(client: OpenWeatherMapAPIWrapper, places: Sequence[str]) None [source]#
Initialize with parameters.
- Parameters:
client (OpenWeatherMapAPIWrapper)
places (Sequence[str])
- 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: str | None = None) WeatherDataLoader [source]#
- Parameters:
places (Sequence[str])
openweathermap_api_key (str | None)
- Return type:
- lazy_load() Iterator[Document] [source]#
Lazily load weather data for the given locations.
- Return type:
Iterator[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