Class PostgresChatMessageHistory (0.6.1)

PostgresChatMessageHistory(
    key,
    engine: langchain_google_cloud_sql_pg.engine.PostgresEngine,
    session_id: str,
    table_name: str,
    messages: typing.List[langchain_core.messages.base.BaseMessage],
)

Chat message history stored in an Cloud SQL for PostgreSQL database.

Methods

aadd_message

aadd_message(message: langchain_core.messages.base.BaseMessage) -> None

Append the message to the record in PostgreSQL

aadd_messages

aadd_messages(
    messages: typing.Sequence[langchain_core.messages.base.BaseMessage],
) -> None

Add a list of messages.

aclear

aclear() -> None

Clear session memory from PostgreSQL

add_message

add_message(message: langchain_core.messages.base.BaseMessage) -> None

Add a Message object to the store.

add_messages

add_messages(
    messages: typing.Sequence[langchain_core.messages.base.BaseMessage],
) -> None

Add a list of messages.

Implementations should over-ride this method to handle bulk addition of messages in an efficient manner to avoid unnecessary round-trips to the underlying store.

clear

clear() -> None

Remove all messages from the store