PostgresChatMessageHistory(
key: object,
engine: langchain_google_cloud_sql_pg.engine.PostgresEngine,
history: langchain_google_cloud_sql_pg.async_chat_message_history.AsyncPostgresChatMessageHistory,
)
Chat message history stored in an Cloud SQL for PostgreSQL database.
Properties
messages
The abstraction required a property.
Methods
PostgresChatMessageHistory
PostgresChatMessageHistory(
key: object,
engine: langchain_google_cloud_sql_pg.engine.PostgresEngine,
history: langchain_google_cloud_sql_pg.async_chat_message_history.AsyncPostgresChatMessageHistory,
)
PostgresChatMessageHistory constructor.
Parameters | |
---|---|
Name | Description |
key |
object
Key to prevent direct constructor usage. |
engine |
PostgresEngine
Database connection pool. |
history |
AsyncPostgresChatMessageHistory
Native async implementation |
Exceptions | |
---|---|
Type | Description |
Exception |
If constructor is directly called by the user. |
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
Append a list of messages to the record in PostgreSQL
aclear
aclear() -> None
Clear session memory from PostgreSQL
add_message
add_message(message: langchain_core.messages.base.BaseMessage) -> None
Append the message to the record in PostgreSQL
add_messages
add_messages(
messages: typing.Sequence[langchain_core.messages.base.BaseMessage],
) -> None
Append a list of messages to the record in PostgreSQL
clear
clear() -> None
Clear session memory from PostgreSQL
create
create(
engine: langchain_google_cloud_sql_pg.engine.PostgresEngine,
session_id: str,
table_name: str,
schema_name: str = "public",
) -> langchain_google_cloud_sql_pg.chat_message_history.PostgresChatMessageHistory
Create a new PostgresChatMessageHistory instance.
Parameters | |
---|---|
Name | Description |
engine |
PostgresEngine
Postgres engine to use. |
session_id |
str
Retrieve the table content with this session ID. |
table_name |
str
Table name that stores the chat message history. |
schema_name |
str, optional
Schema name for the chat message history table. Defaults to "public". |
Exceptions | |
---|---|
Type | Description |
IndexError |
If the table provided does not contain required schema. |
Returns | |
---|---|
Type | Description |
PostgresChatMessageHistory |
A newly created instance of PostgresChatMessageHistory. |
create_sync
create_sync(
engine: langchain_google_cloud_sql_pg.engine.PostgresEngine,
session_id: str,
table_name: str,
schema_name: str = "public",
) -> langchain_google_cloud_sql_pg.chat_message_history.PostgresChatMessageHistory
Create a new PostgresChatMessageHistory instance.
Parameters | |
---|---|
Name | Description |
engine |
PostgresEngine
Postgres engine to use. |
session_id |
str
Retrieve the table content with this session ID. |
table_name |
str
Table name that stores the chat message history. |
schema_name |
str, optional
Database schema name for the chat message history table. Defaults to "public". |
Exceptions | |
---|---|
Type | Description |
IndexError |
If the table provided does not contain required schema. |
Returns | |
---|---|
Type | Description |
PostgresChatMessageHistory |
A newly created instance of PostgresChatMessageHistory. |