frdel / agent-zero

Agent Zero AI framework
Other
4.95k stars 1.1k forks source link

Chromadb: 'Collection' object has no attribute 'model_fields' #17

Open juanchosaravia opened 4 months ago

juanchosaravia commented 4 months ago

Running Agent Zero from a

It gets into a loop which is not able to initialize chromadb.

Error msg:

Agent 0: Using tool 'knowledge_tool':
Question: What is Agent Zero AI and how does it work?

Initializing VectorDB...

{
    "system_error": "Traceback (most recent call last):
  File "/Users/user1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/chromadb/db/mixins/sysdb.py", line 257, in create_collection
    ParameterValue(self.uuid_to_db(collection["id"])),
                                   ~~~~~~~~~~^^^^^^
  File "/Users/user1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/chromadb/types.py", line 99, in __getitem__
    if key in self.model_fields:
              ^^^^^^^^^^^^^^^^^
AttributeError: 'Collection' object has no attribute 'model_fields'

AttributeError: 'Collection' object has no attribute 'model_fields'"
}

Agent 0: Using tool 'knowledge_tool':
Question: Are there any updates or community discussions regarding the 'Collection object has no attribute model_fields' error in ChromaDB?

Initializing VectorDB...

{
    "system_error": "Traceback (most recent call last):
  File "/Users/user1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/chromadb/db/mixins/sysdb.py", line 257, in create_collection
    ParameterValue(self.uuid_to_db(collection["id"])),
                                   ~~~~~~~~~~^^^^^^
  File "/Users/user1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/chromadb/types.py", line 99, in __getitem__
    if key in self.model_fields:
              ^^^^^^^^^^^^^^^^^
AttributeError: 'Collection' object has no attribute 'model_fields'

AttributeError: 'Collection' object has no attribute 'model_fields'"
}
juanchosaravia commented 4 months ago

Found this: https://github.com/langchain-ai/langchain/issues/24163

As a workaround, I forced the chromadb version in the requirements file:

...
chromadb==0.5.3
langchain-chroma==0.1.2
...
aposseadesse commented 4 months ago

Had the same issue. I used the workaround to fix it:

Found this: langchain-ai/langchain#24163

As a workaround, I forced the chromadb version in the requirements file:

...
chromadb==0.5.3
langchain-chroma==0.1.2
...