Find answers from the community

Updated 2 months ago

hi I am saving the messages at the

hi! I am saving the messages at the database so if we have to upgrade production, we can get the back. The problem is that I can't configure them in the new agent:
From this code:
print("chat send", chat_history) self._agent = OpenAIAgent.from_tools( _all_tools, llm=llm, callback_manager=callback_manager, memory=_memory, system_prompt=TEXT_QA_SYSTEM_PROMPT.content, chat_history=chat_history, ) print("chat history", self._agent.chat_history)
I get:
chat send [ChatMessage(role=<MessageRole.USER: 'user'>, content='elmatero', additional_kwargs={}), ChatMessage(role=<MessageRole.ASSISTANT: 'assistant'>, content='Buenos días, mi nombre es Juan Pablo. ¿En qué lo puedo ayudar?', additional_kwargs={}), ChatMessage(role=<MessageRole.USER: 'user'>, content='elmatero', additional_kwargs={}), ChatMessage(role=<MessageRole.ASSISTANT: 'assistant'>, content='Buenos días, mi nombre es Juan Pablo. ¿En qué lo puedo ayudar?', additional_kwargs={})] chat history []
And the format I am passing the agent is the same I get from: self._agent.chat_history
L
e
5 comments
Since you are already passing in a memory module, it is overrding the chat history you are passing in

You should configure the memory to hold the chat history instead
Perfect! I was using the memory to configure the token_limit. How can I do this deleting the memory in the agent?
ChatMemoryBuffer.from_defaults(token_limit=1000, chat_history=chat_history)
ohhh perfectt
thank you againn!!
Add a reply
Sign up and join the conversation on Discord