Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAgents and toolkitsMemoryAWS DynamoDBCassandramemoryMomento CacheMongodDBMot√∂rheadPostgresRedisRemembrallRocksetSingleStoreDBSQL (SQLAlchemy)SQLiteStreamlitUpstash Redis Chat Message HistoryXataZepCallbacksChat loadersComponentsMemoryAWS DynamoDBOn this pageAWS DynamoDBAmazon AWS DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability.This notebook goes over how to use DynamoDB to store chat message history.First make sure you have correctly configured the AWS CLI. Then make sure you have installed boto3.pip install boto3Next, create the DynamoDB Table where we will be storing messages:import boto3# Get the service resource.dynamodb = boto3.resource("dynamodb")# Create the DynamoDB table.table = dynamodb.create_table(    TableName="SessionTable",    KeySchema=[{"AttributeName": "SessionId", "KeyType": "HASH"}],    AttributeDefinitions=[{"AttributeName": "SessionId", "AttributeType": "S"}],    BillingMode="PAY_PER_REQUEST",)# Wait until the table exists.table.meta.client.get_waiter("table_exists").wait(TableName="SessionTable")# Print out some data about the table.print(table.item_count)    0DynamoDBChatMessageHistory‚Äãfrom langchain.memory.chat_message_histories import DynamoDBChatMessageHistoryhistory = DynamoDBChatMessageHistory(table_name="SessionTable", session_id="0")history.add_user_message("hi!")history.add_ai_message("whats up?")history.messages    [HumanMessage(content='hi!', additional_kwargs={}, example=False),     AIMessage(content='whats up?', additional_kwargs={}, example=False),     HumanMessage(content='hi!', additional_kwargs={}, example=False),     AIMessage(content='whats up?', additional_kwargs={},
Amazon AWS DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability.
Amazon AWS DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability. ->: Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAgents and toolkitsMemoryAWS DynamoDBCassandramemoryMomento CacheMongodDBMot√∂rheadPostgresRedisRemembrallRocksetSingleStoreDBSQL (SQLAlchemy)SQLiteStreamlitUpstash Redis Chat Message HistoryXataZepCallbacksChat loadersComponentsMemoryAWS DynamoDBOn this pageAWS DynamoDBAmazon AWS DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability.This notebook goes over how to use DynamoDB to store chat message history.First make sure you have correctly configured the AWS CLI. Then make sure you have installed boto3.pip install boto3Next, create the DynamoDB Table where we will be storing messages:import boto3# Get the service resource.dynamodb = boto3.resource("dynamodb")# Create the DynamoDB table.table = dynamodb.create_table(    TableName="SessionTable",    KeySchema=[{"AttributeName": "SessionId", "KeyType": "HASH"}],    AttributeDefinitions=[{"AttributeName": "SessionId", "AttributeType": "S"}],    BillingMode="PAY_PER_REQUEST",)# Wait until the table exists.table.meta.client.get_waiter("table_exists").wait(TableName="SessionTable")# Print out some data about the table.print(table.item_count)    0DynamoDBChatMessageHistory‚Äãfrom langchain.memory.chat_message_histories import DynamoDBChatMessageHistoryhistory = DynamoDBChatMessageHistory(table_name="SessionTable", session_id="0")history.add_user_message("hi!")history.add_ai_message("whats up?")history.messages    [HumanMessage(content='hi!', additional_kwargs={}, example=False),     AIMessage(content='whats up?', additional_kwargs={}, example=False),     HumanMessage(content='hi!', additional_kwargs={}, example=False),     AIMessage(content='whats up?', additional_kwargs={},