| Name | Type | Description |
|---|---|---|
table_name* | str | name of the DynamoDB table |
session_id* | str | arbitrary key that is used to store the messages of a single chat session. |
endpoint_url | Optional[str] | Default: NoneURL of the AWS endpoint to connect to. This argument is optional and useful for test purposes, like using Localstack. If you plan to use AWS cloud service, you normally don't have to worry about setting the endpoint_url. |
primary_key_name | str | Default: 'SessionId' |
key | Optional[Dict[str, str]] | Default: None |
kms_key_id | Optional[str] | Default: None |
ttl | Optional[int] | Default: None |
history_size | Optional[int] | Default: None |
history_messages_key | Optional[str] | Default: 'History' |
coerce_float_to_decimal | bool | Default: False |
Chat message history that stores history in AWS DynamoDB.
This class expects that a DynamoDB table exists with name table_name
name of the primary key of the DynamoDB table. This argument is optional, defaulting to "SessionId".
an optional dictionary with a custom primary and secondary key. This argument is optional, but useful when using composite dynamodb keys, or isolating records based off of application details such as a user id. This may also contain global and local secondary index keys.
an optional AWS KMS Key ID, AWS KMS Key ARN, or AWS KMS Alias for client-side encryption
Optional Time-to-live (TTL) in seconds. Allows you to define a per-item expiration timestamp that indicates when an item can be deleted from the table. DynamoDB handles deletion of expired items without consuming write throughput. To enable this feature on the table, follow the AWS DynamoDB documentation
Maximum number of messages to store. If None then there is no
limit. If not None then only the latest history_size messages are stored.
Key for the chat history where the messages are stored and updated
If True, all float values in the messages will be converted to Decimal.