Skip to main content
Messenger 是一款由 Meta Platforms 开发的美国专有即时通讯应用和平台。最初于 2008 年作为 Facebook Chat 开发,该公司在 2010 年对其消息服务进行了全面改进。
本笔记本介绍了如何将 Facebook 聊天记录 中的数据加载成可被 LangChain 摄取的格式。
# pip install pandas
from langchain_community.document_loaders import FacebookChatLoader
loader = FacebookChatLoader("example_data/facebook_chat.json")
loader.load()
[Document(page_content='User 2 于 2023-02-05 03:46:11: 再见!\n\nUser 1 于 2023-02-05 03:43:55: 哦,没关系!再见\n\nUser 2 于 2023-02-05 03:24:37: 不,抱歉是我的错,蓝色的那个不卖\n\nUser 1 于 2023-02-05 03:05:40: 我以为你在卖蓝色的那个!\n\nUser 1 于 2023-02-05 03:05:09: 我对这个包不感兴趣。我感兴趣的是蓝色的那个!\n\nUser 2 于 2023-02-05 03:04:28: 这是 $129\n\nUser 2 于 2023-02-05 03:04:05: 网上至少 $100\n\nUser 1 于 2023-02-05 02:59:59: 你想要多少钱?\n\nUser 2 于 2023-02-04 22:17:56: 早上好!$50 太低了。\n\nUser 1 于 2023-02-04 14:17:02: 你好!我对你的包感兴趣。我出价 $50。如果你有兴趣请告诉我。谢谢!\n\n', metadata={'source': 'example_data/facebook_chat.json'})]