I followed langchain's documentation of a chatbot, and my chatbot project was working fine 1~2 months ago. However, after reinstalling dependencies, etc, I've run into the error "AttributeError: pydantic_private". Tracking this error down, it's located in BaseModel class of the pydantic package, where it calls "self.pydantic_private". I'm not sure why this error is thrown, as "pydantic_private" very much exists as an attribute in the BaseModel class.
I have suspicions that I reinstalled the wrong version of packages, which may have led to this problem. Has anyone ran into this problem / any thoughts on solving it?
Here is the entire block of code (located in the BaseModel class of the pydantic package), where the error is thrown when it calls "self.pydantic_private":
def __setattr__(self, name: str, value: Any) -> None:
if name in self.__class_vars__:
raise AttributeError(
f'{name!r} is a ClassVar of `{self.__class__.__name__}` and cannot be set on an instance. '
f'If you want to set a value on the class, use `{self.__class__.__name__}.{name} = value`.'
)
elif not _fields.is_valid_field_name(name):
if self.__pydantic_private__ is None or name not in self.__private_attributes__:
_object_setattr(self, name, value)
else:
attribute = self.__private_attributes__[name]
if hasattr(attribute, '__set__'):
attribute.__set__(self, value) # type: ignore
else:
self.__pydantic_private__[name] = value
return
elif self.model_config.get('frozen', None):
error: pydantic_core.InitErrorDetails = {
'type': 'frozen_instance',
'loc': (name,),
'input': value,
}
raise pydantic_core.ValidationError.from_exception_data(self.__class__.__name__, [error])
elif getattr(self.model_fields.get(name), 'frozen', False):
error: pydantic_core.InitErrorDetails = {
'type': 'frozen_field',
'loc': (name,),
'input': value,
}
raise pydantic_core.ValidationError.from_exception_data(self.__class__.__name__, [error])
attr = getattr(self.__class__, name, None)
if isinstance(attr, property):
attr.__set__(self, value)
elif self.model_config.get('validate_assignment', None):
self.__pydantic_validator__.validate_assignment(self, name, value)
elif self.model_config.get('extra') != 'allow' and name not in self.model_fields:
# TODO - matching error
raise ValueError(f'"{self.__class__.__name__}" object has no field "{name}"')
elif self.model_config.get('extra') == 'allow' and name not in self.model_fields:
# SAFETY: __pydantic_extra__ is not None when extra = 'allow'
self.__pydantic_extra__[name] = value # type: ignore
else:
self.__dict__[name] = value
self.__pydantic_fields_set__.add(name)```
I've tried a different version of chromadb, but to no avail. Not quite sure what the problem is, as this program was working 1~2 months ago.