Neo4j backend chatbot using python
I am getting response for sentences which has hey, hi and hello . For other prompts I am getting error.
ValidationError: 2 validation errors for AIMessage content str type expected (type=type_error.str) content value is not a valid list (type=type_error.list)
Traceback:
File "C:\Users\MTS\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 535, in _run_script
exec(code, module.dict)
File "C:\Users\MTS\OneDrive\Desktop\chatbot\bot.py", line 49, in
handle_submit(prompt)
File "C:\Users\MTS\OneDrive\Desktop\chatbot\bot.py", line 33, in handle_submit
response = generate_response(message)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\MTS\OneDrive\Desktop\chatbot\agent.py", line 48, in generate_response
response = agent_executor.invoke({"input": prompt})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\MTS\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\chains\base.py", line 164, in invoke
final_outputs: Dict[str, Any] = self.prep_outputs(
^^^^^^^^^^^^^^^^^^
File "C:\Users\MTS\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\chains\base.py", line 440, in prep_outputs
self.memory.save_context(inputs, outputs)
File "C:\Users\MTS\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\memory\chat_memory.py", line 40, in save_context
[HumanMessage(content=input_str), AIMessage(content=output_str)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\MTS\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain_core\messages\base.py", line 35, in init
return super().init(content=content, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\MTS\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain_core\load\serializable.py", line 107, in init
super().init(**kwargs)
File "C:\Users\MTS\AppData\Local\Programs\Python\Python311\Lib\site-packages\pydantic\v1\main.py", line 341, in init
raise validation_error