Hey everyone,
I'm new to Neo4j and I'm following along with a tutorial on building a Neo4j-backed chatbot using Python. However, I've hit a snag that's been giving me trouble. I keep encountering this 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 "/workspace/.pyenv_mirror/user/3.11.7/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
exec(code, module.dict)
File "/workspace/llm-chatbot-python/bot.py", line 40, in
handle_submit(prompt)
File "/workspace/llm-chatbot-python/bot.py", line 24, in handle_submit
response = generate_response(message)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/llm-chatbot-python/agent.py", line 39, in generate_response
response = agent_executor.invoke({"input": prompt})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/.pyenv_mirror/user/3.11.7/lib/python3.11/site-packages/langchain/chains/base.py", line 164, in invoke
final_outputs: Dict[str, Any] = self.prep_outputs(
^^^^^^^^^^^^^^^^^^
File "/workspace/.pyenv_mirror/user/3.11.7/lib/python3.11/site-packages/langchain/chains/base.py", line 440, in prep_outputs
self.memory.save_context(inputs, outputs)
File "/workspace/.pyenv_mirror/user/3.11.7/lib/python3.11/site-packages/langchain/memory/chat_memory.py", line 40, in save_context
[HumanMessage(content=input_str), AIMessage(content=output_str)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/.pyenv_mirror/user/3.11.7/lib/python3.11/site-packages/langchain_core/messages/base.py", line 35, in init
return super().init(content=content, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/.pyenv_mirror/user/3.11.7/lib/python3.11/site-packages/langchain_core/load/serializable.py", line 107, in init
super().init(**kwargs)
File "/workspace/.pyenv_mirror/user/3.11.7/lib/python3.11/site-packages/pydantic/v1/main.py", line 341, in init
raise validation_error
This error is popping up when I run the code and start the conversation with the bot, basically the bot responde sometimes normally other times it give me that error , and I'm having trouble understanding and resolving it.
I'm currently stuck at the fifth step of the tutorial, "Creating an Agent," and I've been trying to troubleshoot this issue for two days now. Any insights or guidance would be greatly appreciated!
Thanks in advance for your help!