aws-samples / serverless-pdf-chat

LLM-powered document chat using Amazon Bedrock and AWS Serverless
https://aws.amazon.com/blogs/compute/building-a-serverless-document-chat-with-aws-lambda-and-amazon-bedrock/
MIT No Attribution
228 stars 206 forks source link

Recursion error while using Dynamodb for memory #46

Open Ranjith072 opened 4 months ago

Ranjith072 commented 4 months ago

Hello , i have followed the use case and got everything to work except when i use dynamodb for memory i always get the error.

` message_history = DynamoDBChatMessageHistory( table_name=MEMORY_TABLE, session_id=conversation_id )

memory = ConversationBufferMemory(
    memory_key="chat_history",
    chat_memory=message_history,
    input_key="question",
    output_key="answer",
    return_messages=True,
)

qa = ConversationalRetrievalChain.from_llm(
    llm=llm,
    retriever=faiss_index.as_retriever(),
    memory=memory,    # works if i dont use this option
    return_source_documents=True,
)`

i have tried with different versions of langchain and langchain-community versions without any luck

Screenshot 2024-04-17 at 10 25 31

moserda commented 1 month ago

Hey @Ranjith072 ,

does the issue persist with the latest version of the code (which is using DynamoDB as memory)? Can you please also verify that the issue occurs with a more recent Python version (at least 3.11 or 3.12)?