This could be because of older versions of langchain and it's related libraries using pydantic v1. To resolve this, you can uninstall all related packages with the help of pip list,I uninstalled almost all packages and installed again. https://python.langchain.com/v0.2/docs/how_to/pydantic_compatibility/