Find answers from the community

Updated 2 months ago

Error Encountered in Rerunning Code in Virtual Environment

At a glance

The community member is experiencing an issue where their code runs successfully initially, but then encounters an AttributeError when running it again in the same virtual environment. The error occurs in the OpenAIEmbedding class from the llama_index library. The community member has provided the versions of the libraries they are using, including llama-index (0.10.17), pydantic (2.10.5), openai (1.51.2), llama-index-core (0.11.23), llama-index-vector-stores-supabase (0.2.0), and SQLAlchemy (2.0.36), as well as the Python version (3.8.12). However, there is no explicitly marked answer in the comments.

This is one example where the code runs successfully at first, but when I run it again after some time in the same virtual environment, the following error occurs:

ERROR:
20
21 # Create embedding model
---> 22 embed_model = OpenAIEmbedding(
23 model="text-embedding-ada-002",
24 # api_key=openai.api_key,
25 # Explicitly specify dimensions
26 )
29 encoded_password = quote_plus(password)

File ~/pgvector/venv/lib/python3.8/site-packages/llama_index/embeddings/openai/base.py:315, in OpenAIEmbedding.init(self, mode, model, embed_batch_size, dimensions, additional_kwargs, api_key, api_base, api_version, max_retries, timeout, reuse_client, callback_manager, default_headers, http_client, async_http_client, num_workers, **kwargs)
307 additional_kwargs["dimensions"] = dimensions
309 api_key, api_base, api_version = self._resolve_credentials(
310 api_key=api_key,
311 api_base=api_base,
312 api_version=api_version,
313 )
--> 315 self._query_engine = get_engine(mode, model, _QUERY_MODE_MODEL_DICT)
316 self._text_engine = get_engine(mode, model, _TEXT_MODE_MODEL_DICT)
...
889 else:
890 # this is the current error
891 raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')

AttributeError: pydantic_private.


can you please help me with, these are the versions that I have been using :

Name: llama-index
Version: 0.10.17
Name: pydantic
Version: 2.10.5
Name: openai
Version: 1.51.2
Name: llama-index-core
Version: 0.11.23
Name: llama-index-vector-stores-supabase
Version: 0.2.0
Name: SQLAlchemy
Version: 2.0.36
python version :3.8.12
Add a reply
Sign up and join the conversation on Discord