Examples
Basic Usage:
from langchain_community.chat_message_histories import (
    SingleStoreDBChatMessageHistory
)
message_history = SingleStoreDBChatMessageHistory(
    session_id="my-session",
    host="https://user:password@127.0.0.1:3306/database"
)
Advanced Usage:
from langchain_community.chat_message_histories import (
    SingleStoreDBChatMessageHistory
)
message_history = SingleStoreDBChatMessageHistory(
    session_id="my-session",
    host="127.0.0.1",
    port=3306,
    user="user",
    password="password",
    database="db",
    table_name="my_custom_table",
    pool_size=10,
    timeout=60,
)
Using environment variables:
from langchain_community.chat_message_histories import (
    SingleStoreDBChatMessageHistory
)
os.environ['SINGLESTOREDB_URL'] = 'me:p455w0rd@s2-host.com/my_db'
message_history = SingleStoreDBChatMessageHistory("my-session")
Attributes
messages
Retrieve the messages from SingleStoreDB
Methods
__init__(session_id, *[, table_name, ...])
Initialize with necessary components.
add_ai_message(message)
Convenience method for adding an AI message string to the store.
add_message(message)
Append the message to the record in SingleStoreDB
add_user_message(message)
Convenience method for adding a human message string to the store.
clear()
Clear session memory from SingleStoreDB