Skip to content

Commit 68741c8

Browse files
committed
review changes
1 parent 7e80b4f commit 68741c8

File tree

2 files changed

+6
-24
lines changed

2 files changed

+6
-24
lines changed

examples/pg_chat_message_history.ipynb

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -104,28 +104,11 @@
104104
},
105105
"outputs": [],
106106
"source": [
107-
"TABLE_NAME = \"chat history\"\n",
107+
"TABLE_NAME = \"chat_history\"\n",
108108
"\n",
109109
"pg_engine.init_chat_history_table(table_name=TABLE_NAME)"
110110
]
111111
},
112-
{
113-
"cell_type": "markdown",
114-
"metadata": {},
115-
"source": [
116-
"#### Optional Tip: 💡\n",
117-
"You can also specify a schema name by passing `schema_name` wherever you pass `table_name`. Eg:\n",
118-
"\n",
119-
"```python\n",
120-
"SCHEMA_NAME=\"my_schema\"\n",
121-
"\n",
122-
"engine.init_chat_history_table(\n",
123-
" table_name=TABLE_NAME,\n",
124-
" schema_name=SCHEMA_NAME # Default: \"public\"\n",
125-
")\n",
126-
"```"
127-
]
128-
},
129112
{
130113
"cell_type": "markdown",
131114
"metadata": {},
@@ -195,11 +178,11 @@
195178
"cell_type": "markdown",
196179
"metadata": {},
197180
"source": [
198-
"## 🔗 Chaining\n",
181+
"## Chaining\n",
199182
"\n",
200-
"We can easily combine this message history class with [LCEL Runnables](/docs/expression_language/how_to/message_history)\n",
183+
"We can easily combine this message history class with [LCEL Runnables](https://python.langchain.com/docs/concepts/lcel/) such as `RunnableWithMessageHistory`.\n",
201184
"\n",
202-
"To do this we will use one of [Google's Vertex AI chat models](https://python.langchain.com/docs/integrations/chat/google_vertex_ai_palm)\n"
185+
"To create an agent or chain, you will need a model. This example will use one of [Google's Vertex AI chat models](https://python.langchain.com/docs/integrations/chat/google_vertex_ai_palm)\n"
203186
]
204187
},
205188
{
@@ -231,6 +214,7 @@
231214
},
232215
"outputs": [],
233216
"source": [
217+
"## Please update the project id\n",
234218
"GOOGLE_CLOUD_PROJECT_ID = \"\"\n",
235219
"\n",
236220
"prompt = ChatPromptTemplate.from_messages(\n",

langchain_postgres/v2/async_chat_message_history.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async def create(
8484
f"\nCREATE TABLE {schema_name}.{table_name} ("
8585
"\n id INT AUTO_INCREMENT PRIMARY KEY,"
8686
"\n session_id TEXT NOT NULL,"
87-
"\n data JSON NOT NULL,"
87+
"\n data JSONB NOT NULL,"
8888
"\n type TEXT NOT NULL"
8989
"\n);"
9090
)
@@ -153,9 +153,7 @@ def _convert_to_messages(self, rows: Sequence[RowMapping]) -> list[BaseMessage]:
153153

154154
async def _aget_messages(self) -> list[BaseMessage]:
155155
"""Retrieve the messages from Postgres."""
156-
157156
query = self._select_query()
158-
159157
async with self.pool.connect() as conn:
160158
result = await conn.execute(text(query), {"session_id": self.session_id})
161159
result_map = result.mappings()

0 commit comments

Comments
 (0)