Find answers from the community

Updated 5 months ago

**TypeError: Object of type

At a glance

The community member is experiencing a TypeError: Object of type AgentChatResponse is not JSON serializable error when using the chat_history for agent chat in Llama Index. The code they provided works fine for the first query, but the error occurs from the second query onwards. The community member is seeking a quick resolution to this issue and has asked for help.

In the comments, another community member has asked about the version of Llama Index being used and requested the full traceback of the error, but there is no explicitly marked answer yet.

TypeError: Object of type AgentChatResponse is not JSON serializable

Getting this error while using chat_history for agent chat in Llama Index. Need a quick resolution. Any help on this? You can get the code below-

'''chat_history.append(ChatMessage(role= MessageRole.USER, content=user_message))

response = agent.chat(message=user_message, chat_history= chat_history)

chat_history.append(ChatMessage(role= MessageRole.ASSISTANT, content=response))'''

It is working fine for the 1st time query and giving the error from 2nd one.

Any quick fix?
L
1 comment
what version of llama-index do you have? Should be working fine tbh

Whats the full traceback?
Add a reply
Sign up and join the conversation on Discord