Skip to content

The agent engineering platform.

Fixed an unhandled error that was raised when DynamoDB did not have any chat history. (#6141)

Shu46782ad79b3c
diff --git a/langchain/memory/chat_message_histories/dynamodb.py b/langchain/memory/chat_message_histories/dynamodb.py
index dfde145713..ef9699221b 100644
--- a/langchain/memory/chat_message_histories/dynamodb.py
+++ b/langchain/memory/chat_message_histories/dynamodb.py
@@ -44,6 +44,7 @@ class DynamoDBChatMessageHistory(BaseChatMessageHistory):
"""Retrieve the messages from DynamoDB"""
from botocore.exceptions import ClientError
+ response = None
try:
response = self.table.get_item(Key={"SessionId": self.session_id})
except ClientError as error: