June 9, 2024, 8:12 p.m. | Sourav Mukherjee

DEV Community dev.to

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.

agent assistant chat code error giving index json llama llamaindex llm object openai query resolution role type while you

Senior Data Engineer

@ Displate | Warsaw

Solution Architect

@ Philips | Bothell - B2 - Bothell 22050

Senior Product Development Engineer - Datacenter Products

@ NVIDIA | US, CA, Santa Clara

Systems Engineer - 2nd Shift (Onsite)

@ RTX | PW715: Asheville Site W Asheville Greenfield Site TBD , Asheville, NC, 28803 USA

System Test Engineers (HW & SW)

@ Novanta | Barcelona, Spain

Senior Solutions Architect, Energy

@ NVIDIA | US, TX, Remote