chainlit icon indicating copy to clipboard operation
chainlit copied to clipboard

Fix: DynamoDB Typeerror with AWS Bedrock

Open munday-tech opened this issue 1 year ago • 10 comments

When using AWS Bedrock, _update_item throws a TypeError as AWS Bedrock returns floats in its response. Dynamodb requires floats to be provided as Decimal. The reverse can also occur if you call get_thread from anywhere in code, as Decimal is not JSON serializable.

The issue can be seen here #1116

I have added two new functions within DynamoDBDataLater that converts floats to decimals and decimals to floats, calling each function from _update_item and get_thread respectively. This change resolves the TypeErrors.

munday-tech avatar Jul 25 '24 08:07 munday-tech