I am very new to python… in every way. Which, may be the root of the problem. I was attempting to follow a RAG tutorial watching Llama3 Full Rag – API with Ollama, LangChain and ChromaDB with Flask API and PDF upload. His github for this program is here.
That might be overkill. I basically came across two errors:
pydantic.v1.error_wrappers.ValidationError: 1 validation error for FastEmbedEmbeddings _model extra fields not permitted (type=value_error.extra)
My solution was to try this:
class FastEmbedEmbeddings(BaseModel, Embeddings):
""" Many attributes here """
_model: Any # : :meta private:
class Config:
# extra = Extra.forbid
extra = Extra.ignore
Since I couldn’t emphasize in the block, extra = Extra.ignore was my change. Which leads to:
AttributeError: 'FastEmbedEmbeddings' object has no attribute '_model'
(looks at fastembed.py
snippet above and wonders…)
In the first case the server doesn’t start. In the second it does but basically if I try to store a document or execute a query this line produces an errors storing and starting to retrieve respectively:
File "/usr/local/lib/python3.10/dist-packages/langchain_community/embeddings/fastembed.py", line 108, in embed_documents
embeddings = self._model.embed(texts)
File "/usr/local/lib/python3.10/dist-packages/langchain_community/embeddings/fastembed.py", line 120, in embed_query
query_embeddings: np.ndarray = next(self._model.query_embed(text))
It’s protected/private and called within the file / class / method in class… is this a version problem?
- pydantic 2.8.2
- pydantic_core 2.20.1
- fastembed 0.3.3
Is it because i did sudo pip install
and after discovering this led to some packages being visible and others not I may have messed up my python install? I decided to update everything which broke a lot. Then using the errors and AI got a set of commands to restore packages to their proper versions… then I followed up the sudo pip install
with a pip install
of the same packages.
Everything seemed to work fine along the way until I started to use the embeddings.