Skip to content

Dynamo Chatmessage history #26543

Answered by dosubot bot
VpkPrasanna asked this question in Q&A
Sep 16, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

To resolve the error TypeError('Float types are not supported. Use Decimal types instead.') when using DynamoDBChatMessageHistory, you need to ensure that any float values being stored in DynamoDB are converted to Decimal types. This is because DynamoDB does not support float types directly.

Here is a modified version of the add_message method that converts float values to Decimal before storing them in DynamoDB:

from decimal import Decimal

def add_message(self, message: BaseMessage) -> None:
    """Append the message to the record in DynamoDB"""
    try:
        from botocore.exceptions import ClientError
    except ImportError as e:
        raise ImportError(
            "Unable to im…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@VpkPrasanna
Comment options

Answer selected by VpkPrasanna
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant