langchain_community.document_loaders.weather
.WeatherDataLoader¶
- class langchain_community.document_loaders.weather.WeatherDataLoader(client: OpenWeatherMapAPIWrapper, places: Sequence[str])[source]¶
使用`Open Weather Map` API加载天气数据。
使用OpenWeatherMap的免费API读取任何位置的预报和当前天气。查看’https://openweathermap.org/appid’了解如何生成免费的OpenWeatherMap API。
使用参数进行初始化。
Methods
__init__
(client, places)使用参数进行初始化。
一个用于文档的惰性加载器。
aload
()将数据加载到文档对象中。
from_params
(places, *[, openweathermap_api_key])为给定的位置延迟加载天气数据。
load
()将数据加载到文档对象中。
load_and_split
([text_splitter])加载文档并分割成块。块作为文档返回。
- Parameters
client (OpenWeatherMapAPIWrapper) –
places (Sequence[str]) –
- Return type
None
- __init__(client: OpenWeatherMapAPIWrapper, places: Sequence[str]) None [source]¶
使用参数进行初始化。
- Parameters
client (OpenWeatherMapAPIWrapper) –
places (Sequence[str]) –
- Return type
None
- 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
- load_and_split(text_splitter: Optional[TextSplitter] = None) List[Document] ¶
加载文档并分割成块。块作为文档返回。
不要覆盖此方法。应该被视为已弃用!
- 参数:
- text_splitter: 用于分割文档的TextSplitter实例。
默认为RecursiveCharacterTextSplitter。
- 返回:
文档列表。
- Parameters
text_splitter (Optional[TextSplitter]) –
- Return type
List[Document]