Open zhaoyuchen1128 opened 1 week ago
memory = ConversationBufferMemory(memory_key="chat_history") chat_history=[] if co.count_documents(query) != 0:
for i in range(0, len(co.find(query)[0]["content"]), 1): if i % 2 == 0: chat_history.append(HumanMessage(content=co.find(query)[0]["content"][i])) else: chat_history.append(AIMessage(content=co.find(query)[0]["content"][i])) memory.chat_memory=chat_history llm = OLLAMA(model=language_model) print(memory.chat_memory) tools = load_tools(["google-serper"], llm=llm) agent = initialize_agent(tools, llm, agent=AgentType.CHAT_CONVERSATIONAL_REACT_DESCRIPTION, verbose=True,memory=memory) xx=agent.run(content)
ValueError: variable chat_history should be a list of base messages
我就是想将memory加载到agent中,加载到conversationchain时都没问题
windows latest
memory如果什么都不操作也报同样的错误
@zhaoyuchen1128 please provide complete example code.
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