ImportError: cannot import name 'field_validator' from 'pydantic'

Hi Everyone,

I ran the code to load PDF docs in my Jupyter Notebook in my laptop. I got this error. Could you please advice me? Thanks.

Try1:
! pip install pypdf
! pip install pydantic -U

from langchain.document_loaders import PyPDFLoader
loader = PyPDFLoader(“./databook.pdf”)
pages = loader.load()

Try2:
%pip install -qU pypdf
pip install pydantic==1.10.11
from langchain_community.document_loaders import PyPDFLoader

loader = PyPDFLoader(“./databook.pdf”)
pages =
async for page in loader.alazy_load():
pages.append(page)

can you share a screenshot of the complete error

in the course they pypdf??

there must be a requirement txt file which provides information on versions of modules you should have to run the codes locally successfully.

did you check that? for pydantic

what is the version of ‘pydantic’? do you have any doc about how to generate the info? how to connect to Langchain?

Please see my questions above. Sorry for confusing you from the previous API connect info.

How can I check pydantic versions of modules? Could you provide sample code here? how the txt file looks like? thanks.

version information will be available in file name requirements.txt file, which you will find in the lesson you working on by clicking File==>Open section.

Let me know if the issue still persist.