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(____)