I wanted to adapt this sample to use Amazon Bedrock. This repo is using a VERY old version of LangChain, so I created a new Lambda layer with a more recent version of LangChain. The function kept failing with
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
After commenting out the memory parameter of ConversationChain as well as commenting out the entire LexConversationalMemory, the function works with both the original SageMaker dispatcher as well as my new Bedrock dispatcher. Not sure what the problem is, but this class seems to be incompatible with more recent versions of LangChain.
I was able to get this working by removing BaseModel from the class definition.
i.e. class LexConversationalMemory(BaseMemory, BaseModel)
becomes class LexConversationalMemory(BaseMemory)
I wanted to adapt this sample to use Amazon Bedrock. This repo is using a VERY old version of LangChain, so I created a new Lambda layer with a more recent version of LangChain. The function kept failing with TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
After commenting out the memory parameter of ConversationChain as well as commenting out the entire LexConversationalMemory, the function works with both the original SageMaker dispatcher as well as my new Bedrock dispatcher. Not sure what the problem is, but this class seems to be incompatible with more recent versions of LangChain.