HTML 文档加载器
可以从多种格式加载文档,包括像 HTML 这样的复杂格式。
在本练习中,您将加载一个包含白宫行政命令的 HTML 文件。
本练习是课程的一部分
使用 LangChain 开发 LLM 应用
练习说明
- 使用
UnstructuredHTMLLoader类加载当前目录中的white_house_executive_order_nov_2023.html文件。 - 将文档加载到内存中。
- 打印第一个文档。
- 打印第一个文档的元数据。
交互式实操练习
通过完成这段示例代码来试试这个练习。
from langchain_community.document_loaders import UnstructuredHTMLLoader
# Create a document loader for unstructured HTML
loader = ____
# Load the document
data = ____
# Print the first document
print(____)
# Print the first document's metadata
print(____)