31 LangChain入門 - 3行代碼實現OpenAI聊天記錄的文件或數據庫存儲

学习与实践
1 次觀看·2023年11月5日

LangChain框架提供了消息歷史持久化的機制,將OpenAI的聊天記錄存儲到文件或數據庫中。這裏我們通過示例代碼,展示如何輕鬆地將聊天記錄存儲到文件中。

代碼
https://github.com/sugarforever/LangChain-Tutorials/blob/main/Langchain_Memory_Persistent_Store.ipynb

相關鏈接
https://python.langchain.com/docs/modules/memory/agent_with_memory_in_db
https://github.com/langchain-ai/langchain/blob/master/langchain/memory/chat_message_histories