from langchain_community.chat_message_histories import SQLChatMessageHistory

from .config import AppConfig


def create_message_history(config: AppConfig, session_id: str) -> SQLChatMessageHistory:
    return SQLChatMessageHistory(
        session_id=session_id,
        connection=config.database_url,
        table_name=config.history_table_name,
    )
