fix(DynamoDBChatMessageHistory): correct delete_item method call (#10383)

**Description**: 
Fixed a bug introduced in version 0.0.281 in
`DynamoDBChatMessageHistory` where `self.table.delete_item(self.key)`
produced a TypeError: `TypeError: delete_item() only accepts keyword
arguments`. Updated the method call to
`self.table.delete_item(Key=self.key)` to resolve this issue.

Please see also [the official AWS
documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/delete_item.html#)
on this **delete_item** method - only `**kwargs` are accepted.

See also the PR, which introduced this bug:
https://github.com/langchain-ai/langchain/pull/9896#discussion_r1317899073

Please merge this, I rely on this delete dynamodb item functionality
(because of GDPR considerations).

**Dependencies**: 
None

**Tag maintainer**: 
@hwchase17 @joshualwhite 

**Twitter handle**: 
[@BenjaminLinnik](https://twitter.com/BenjaminLinnik)
Co-authored-by: Benjamin Linnik <Benjamin@Linnik-IT.de>
pull/10469/head
Nante Nantero 12 months ago committed by GitHub
parent 30c9d97dda
commit 41047fe4c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -121,6 +121,6 @@ class DynamoDBChatMessageHistory(BaseChatMessageHistory):
) from e
try:
self.table.delete_item(self.key)
self.table.delete_item(Key=self.key)
except ClientError as err:
logger.error(err)

Loading…
Cancel
Save