Open zhaoyuchen1128 opened 5 months ago
memory如果什么都不操作也报同样的错误
@zhaoyuchen1128 please provide complete example code.
https://python.langchain.com/v0.2/docs/how_to/agent_executor/#adding-in-memory
`python from langchain_community.chat_message_histories import ChatMessageHistory from langchain_core.chat_history import BaseChatMessageHistory from langchain_core.runnables.history import RunnableWithMessageHistory
store = {}
def get_session_history(session_id: str) -> BaseChatMessageHistory: if session_id not in store: store[session_id] = ChatMessageHistory() return store[session_id]
agent_with_chat_history = RunnableWithMessageHistory( agent_executor, get_session_history, input_messages_key="input", history_messages_key="chat_history", )
`
Hi, @zhaoyuchen1128. I'm Dosu, and I'm helping the LangChain team manage their backlog. I'm marking this issue as stale.
Issue Summary
Next Steps
Thank you for your understanding and contribution!
Checked other resources
Example Code
memory = ConversationBufferMemory(memory_key="chat_history") chat_history=[] if co.count_documents(query) != 0:
Error Message and Stack Trace (if applicable)
ValueError: variable chat_history should be a list of base messages
Description
我就是想将memory加载到agent中,加载到conversationchain时都没问题
System Info
windows latest