SpannerChatMessageHistory(
instance_id: str,
database_id: str,
session_id: str,
table_name: str,
client: typing.Optional[google.cloud.spanner_v1.client.Client] = None,
)Chat message history that stores history in Spanner.
Properties
messages
Retrieve the messages from Cloud Spanner
Methods
_verify_schema
_verify_schema() -> NoneVerify table exists with required schema for SpannerChatMessageHistory class. Use helper method MSSQLEngine.create_chat_history_table(...) to create table with valid schema.
add_message
add_message(message: langchain_core.messages.base.BaseMessage) -> NoneAppend the message to the record in Cloud Spanner
clear
clear() -> NoneClear session memory from Cloud Spanner
create_chat_history_table
create_chat_history_table(
instance_id: str,
database_id: str,
table_name: str,
client: typing.Optional[google.cloud.spanner_v1.client.Client] = None,
) -> NoneCreate a chat history table in a Cloud Spanner database.
| Parameters | |
|---|---|
| Name | Description |
instance_id |
str
The ID of the Cloud Spanner instance. |
database_id |
str
The ID of the Cloud Spanner database. |
table_name |
str
The name of the table to be created. |
client |
spanner.Client, optional
An instance of the Cloud Spanner client. Defaults to None. |
| Exceptions | |
|---|---|
| Type | Description |
Exception |
If the specified instance or database does not exist. |
| Returns | |
|---|---|
| Type | Description |
Operation |
The operation to create the table. |