Warning raised when calling VectorStoreCreator()

I’m in lesson 4 and running the notebook locally on my device. I’m running python v 3.11 in venv. My OPENAI_API_KEY env variable is set correctly. I’ve also downloaded the csv data file and confirmed that it’s placed in the correct folder with the notebook and loads successfully given the file path when calling loader.load(). This is confirmed by the metadata in the dict reporting the file path and 999 rows.

When attempting to run the following cell, there is a warning that is raised.

index = VectorstoreIndexCreator(
    vectorstore_cls=DocArrayInMemorySearch
).from_loaders([loader])

The warning is as follows.

/Users/pchittum/projects/learning/venv-jupyter/lib/python3.11/site-packages/pydantic/_migration.py:281: UserWarning: pydantic.error_wrappers:ValidationError has been moved to pydantic:ValidationError.
warnings.warn(f’{import_path} has been moved to {new_location}.')

There was a pip version notice when I executed the docarray install command in the previous cell.

The subsequent cells are:

query ="Please list all your shirts with sun protection \
in a table in markdown and summarize each one."

and

response = index.query(query)

That last cell throws an error:

ValidationError: 2 validation errors for DocArrayDoc
text
Field required [type=missing, input_value={‘embedding’: [0.00332062… -0.021229914268597688]}, input_type=dict]
For further information visit Redirecting...
metadata
Field required [type=missing, input_value={‘embedding’: [0.00332062… -0.021229914268597688]}, input_type=dict]
For further information visit Redirecting...

This almost seems like a problem with a version mismatch in the pydantic library in the notebook. And since I’m all out of API calls to OpenAI, I can’t test in the online version of the notebook whether or not this problem exists in the hosted environment.

I’m also pretty new to python, so I could totally see that this might be a local runtime issue. Running platform.python_version() on the notebook returns 3.9.17. Is that possibly the problem?

Thanks for any nudges in the right direction. I’m sure I’ll learn something. :slight_smile:

@pchittum I had the same problem and I finally got around it by installing a much older version of langchain. I first tried downgrading by one version at a time from 0.0.324 to 0.0.319 and that didn’t work, so I then arbitrarily chose 0.0.190 and that worked.

I had to install some missing packages like docarray, tiktoken, etc and had a few package dependency conflicts and had to upgrade a few but got there in the end after many hours wasted.

I do wish the course listed the version of the packages they used in their lessons, I wasted hours trying to get it working.

PS: I’m using Python 3.10.12 in a miniconda environment.


i am getting api deployment error while running this code:
index = VectorstoreIndexCreator(
vectorstore_cls=DocArrayInMemorySearch,
embedding=embeddings,
).from_loaders([loader])

If you run !pip3 list, you can see which version of langchain they used in their notebook. Mine give langchain==0.0.179. I’m still confused though why they put #pip install --upgrade langchain in the first cell.


Edit
I tried downgrading langchain and docarray but it didn’t work. I found github issue here, downgrading pydantic instead to 1.10.10 works for me.