aws-samples / conversational-ai-llms-with-amazon-lex-and-sagemaker

MIT No Attribution
28 stars 11 forks source link

LangChain version #13

Open ryanjmich opened 8 months ago

ryanjmich commented 8 months ago

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.

ryanjmich commented 8 months ago

I was able to get this working by removing BaseModel from the class definition. i.e. class LexConversationalMemory(BaseMemory, BaseModel) becomes class LexConversationalMemory(BaseMemory)