langchain_community.chat_message_histories.xata.XataChatMessageHistory¶

class langchain_community.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: Union[AIMessage, str]) None¶

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

Parameters

message – The AI message to add.

add_message(message: BaseMessage) None[source]¶

Append the message to the Xata table

add_user_message(message: Union[HumanMessage, str]) None¶

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

Parameters

message – The human message to add

clear() None[source]¶

Delete session from Xata table.

Examples using XataChatMessageHistory¶