Notebook L2-lcel-student. Validation error DocArray, pydantic

When executing the notebook L2-lcel-student locally I got an error at the following step,

vectorstore = DocArrayInMemorySearch.from_texts(
    ["harrison worked at kensho", "bears like to eat honey"],
    embedding=OpenAIEmbeddings()
)
vectorstore
retriever = vectorstore.as_retriever()
retriever.get_relevant_documents("where did harrison work?")

The get_relevant_documents throws an error: langchain vector store retriever validation errors for DocArrayDoc.

The following version work without error:
pydantic==1.10.10
langchain==0.0.325

Could you share the versions that are used in the notebook on the course page?
I’ve tried running !pip list in the notebook hosted at the course, but it says that pip is not installed.

Hello Adam,

I’ve downloaded and successfully run the notebook file on my local machine without any issues. My package versions for pydantic and langchain are 1.10.12 and 0.0.314, respectively.

If you’re still encountering problems, how about considering downloading and running it on your local machine?

Hi Taekyo, yes it works for me too on local machine with the following versions

pydantic==1.10.10
langchain==0.0.325

My question was which versions that are run on the hosted notebook.

Hi Adam,
Oh I got it. You can check it on the hosted notebook by executing the following command.

import langchain
import pydantic
print(langchain.__version__)
print(pydantic.__version__)

My result is

0.0.312
1.10.8

I hope it will be helpful.
Keep it up~

Hi all
Thank you.
What about openai version ?
Thank you.
I am having trouble making openai 1.2.3, langchain 0.0.335 and pydantic 2.5.0 nicely working together
Cheers

I am answering to myself :slight_smile:
I had sucess using versions mentioned in Adam’s post and downgrading openai to 0.28.1. It seems there are breaking changes in openai v1+ & pydantic v2+