langchain.memory.chat_message_histories.xata.XataChatMessageHistory

class langchain.memory.chat_message_histories.xata.XataChatMessageHistory(session_id: str, db_url: str, api_key: str, branch_name: str = 'main', table_name: str = 'messages', create_table: bool = True)[source]

Chat message history stored in a Xata database.

Initialize with Xata client.

Attributes

messages

Methods

__init__(session_id, db_url, api_key[, ...])

Initialize with Xata client.

add_ai_message(message)

Convenience method for adding an AI message string to the store.

add_message(message)

Append the message to the Xata table

add_user_message(message)

Convenience method for adding a human message string to the store.

clear()

Delete session from Xata table.

__init__(session_id: str, db_url: str, api_key: str, branch_name: str = 'main', table_name: str = 'messages', create_table: bool = True) None[source]

Initialize with Xata client.

add_ai_message(message: str) None

Convenience method for adding an AI message string to the store.

Parameters

message – The string contents of an AI message.

add_message(message: BaseMessage) None[source]

Append the message to the Xata table

add_user_message(message: str) None

Convenience method for adding a human message string to the store.

Parameters

message – The string contents of a human message.

clear() None[source]

Delete session from Xata table.

Examples using XataChatMessageHistory