langchain-postgres 0.0.5__tar.gz → 0.0.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {langchain_postgres-0.0.5 → langchain_postgres-0.0.7}/PKG-INFO +7 -92
- {langchain_postgres-0.0.5 → langchain_postgres-0.0.7}/README.md +5 -90
- {langchain_postgres-0.0.5 → langchain_postgres-0.0.7}/langchain_postgres/__init__.py +0 -8
- {langchain_postgres-0.0.5 → langchain_postgres-0.0.7}/langchain_postgres/vectorstores.py +897 -77
- {langchain_postgres-0.0.5 → langchain_postgres-0.0.7}/pyproject.toml +8 -2
- langchain_postgres-0.0.5/langchain_postgres/checkpoint.py +0 -587
- {langchain_postgres-0.0.5 → langchain_postgres-0.0.7}/LICENSE +0 -0
- {langchain_postgres-0.0.5 → langchain_postgres-0.0.7}/langchain_postgres/_utils.py +0 -0
- {langchain_postgres-0.0.5 → langchain_postgres-0.0.7}/langchain_postgres/chat_message_histories.py +0 -0
- {langchain_postgres-0.0.5 → langchain_postgres-0.0.7}/langchain_postgres/py.typed +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: langchain-postgres
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.7
|
4
4
|
Summary: An integration package connecting Postgres and LangChain
|
5
5
|
Home-page: https://github.com/langchain-ai/langchain-postgres
|
6
6
|
License: MIT
|
@@ -12,13 +12,13 @@ Classifier: Programming Language :: Python :: 3.10
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
14
14
|
Requires-Dist: langchain-core (>=0.1.50,<0.3)
|
15
|
-
Requires-Dist: langgraph (>=0.0.32,<0.0.33)
|
16
15
|
Requires-Dist: numpy (>=1,<2)
|
17
16
|
Requires-Dist: pgvector (>=0.2.5,<0.3.0)
|
18
17
|
Requires-Dist: psycopg (>=3,<4)
|
19
18
|
Requires-Dist: psycopg-pool (>=3.2.1,<4.0.0)
|
20
19
|
Requires-Dist: sqlalchemy (>=2,<3)
|
21
20
|
Project-URL: Repository, https://github.com/langchain-ai/langchain-postgres
|
21
|
+
Project-URL: Source Code, https://github.com/langchain-ai/langchain-postgres/tree/master/langchain_postgres
|
22
22
|
Description-Content-Type: text/markdown
|
23
23
|
|
24
24
|
# langchain-postgres
|
@@ -46,98 +46,13 @@ The package currently only supports the [psycogp3](https://www.psycopg.org/psyco
|
|
46
46
|
pip install -U langchain-postgres
|
47
47
|
```
|
48
48
|
|
49
|
-
##
|
50
|
-
|
51
|
-
### PostgresSaver (LangGraph Checkpointer)
|
52
|
-
|
53
|
-
The LangGraph checkpointer can be used to add memory to your LangGraph application.
|
54
|
-
|
55
|
-
`PostgresSaver` is an implementation of the checkpointer saver using
|
56
|
-
Postgres as the backend.
|
57
|
-
|
58
|
-
Currently, only the psycopg3 driver is supported.
|
59
|
-
|
60
|
-
Sync usage:
|
61
|
-
|
62
|
-
```python
|
63
|
-
from psycopg_pool import ConnectionPool
|
64
|
-
from langchain_postgres import (
|
65
|
-
PostgresSaver, PickleCheckpointSerializer
|
66
|
-
)
|
67
|
-
|
68
|
-
pool = ConnectionPool(
|
69
|
-
# Example configuration
|
70
|
-
conninfo="postgresql://langchain:langchain@localhost:6024/langchain",
|
71
|
-
max_size=20,
|
72
|
-
)
|
73
|
-
|
74
|
-
PostgresSaver.create_tables(pool)
|
75
|
-
|
76
|
-
checkpointer = PostgresSaver(
|
77
|
-
serializer=PickleCheckpointSerializer(),
|
78
|
-
sync_connection=pool,
|
79
|
-
)
|
80
|
-
|
81
|
-
# Set up the langgraph workflow with the checkpointer
|
82
|
-
workflow = ... # Fill in with your workflow
|
83
|
-
app = workflow.compile(checkpointer=checkpointer)
|
84
|
-
|
85
|
-
# Use with the sync methods of `app` (e.g., `app.stream())
|
86
|
-
|
87
|
-
pool.close() # Remember to close the connection pool.
|
88
|
-
```
|
89
|
-
|
90
|
-
Async usage:
|
49
|
+
## Change Log
|
91
50
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
PostgresSaver, PickleCheckpointSerializer
|
96
|
-
)
|
97
|
-
|
98
|
-
pool = AsyncConnectionPool(
|
99
|
-
# Example configuration
|
100
|
-
conninfo="postgresql://langchain:langchain@localhost:6024/langchain",
|
101
|
-
max_size=20,
|
102
|
-
)
|
103
|
-
|
104
|
-
# Create the tables in postgres (only needs to be done once)
|
105
|
-
await PostgresSaver.acreate_tables(pool)
|
106
|
-
|
107
|
-
checkpointer = PostgresSaver(
|
108
|
-
serializer=PickleCheckpointSerializer(),
|
109
|
-
async_connection=pool,
|
110
|
-
)
|
111
|
-
|
112
|
-
# Set up the langgraph workflow with the checkpointer
|
113
|
-
workflow = ... # Fill in with your workflow
|
114
|
-
app = workflow.compile(checkpointer=checkpointer)
|
115
|
-
|
116
|
-
# Use with the async methods of `app` (e.g., `app.astream()`)
|
117
|
-
|
118
|
-
await pool.close() # Remember to close the connection pool.
|
119
|
-
```
|
120
|
-
|
121
|
-
#### Testing
|
122
|
-
|
123
|
-
If testing with the postgres checkpointer it may be useful to both create and
|
124
|
-
drop the tables before and after the tests.
|
125
|
-
|
126
|
-
```python
|
127
|
-
from psycopg_pool import ConnectionPool
|
128
|
-
from langchain_postgres import (
|
129
|
-
PostgresSaver
|
130
|
-
)
|
131
|
-
with ConnectionPool(
|
132
|
-
# Example configuration
|
133
|
-
conninfo="postgresql://langchain:langchain@localhost:6024/langchain",
|
134
|
-
max_size=20,
|
135
|
-
) as conn:
|
136
|
-
PostgresSaver.create_tables(conn)
|
137
|
-
PostgresSaver.drop_tables(conn)
|
138
|
-
# Run your unit tests with langgraph
|
139
|
-
```
|
51
|
+
0.0.6:
|
52
|
+
- Remove langgraph as a dependency as it was causing dependency conflicts.
|
53
|
+
- Base interface for checkpointer changed in langgraph, so existing implementation would've broken regardless.
|
140
54
|
|
55
|
+
## Usage
|
141
56
|
|
142
57
|
### ChatMessageHistory
|
143
58
|
|
@@ -23,98 +23,13 @@ The package currently only supports the [psycogp3](https://www.psycopg.org/psyco
|
|
23
23
|
pip install -U langchain-postgres
|
24
24
|
```
|
25
25
|
|
26
|
-
##
|
27
|
-
|
28
|
-
### PostgresSaver (LangGraph Checkpointer)
|
29
|
-
|
30
|
-
The LangGraph checkpointer can be used to add memory to your LangGraph application.
|
31
|
-
|
32
|
-
`PostgresSaver` is an implementation of the checkpointer saver using
|
33
|
-
Postgres as the backend.
|
34
|
-
|
35
|
-
Currently, only the psycopg3 driver is supported.
|
36
|
-
|
37
|
-
Sync usage:
|
38
|
-
|
39
|
-
```python
|
40
|
-
from psycopg_pool import ConnectionPool
|
41
|
-
from langchain_postgres import (
|
42
|
-
PostgresSaver, PickleCheckpointSerializer
|
43
|
-
)
|
44
|
-
|
45
|
-
pool = ConnectionPool(
|
46
|
-
# Example configuration
|
47
|
-
conninfo="postgresql://langchain:langchain@localhost:6024/langchain",
|
48
|
-
max_size=20,
|
49
|
-
)
|
50
|
-
|
51
|
-
PostgresSaver.create_tables(pool)
|
52
|
-
|
53
|
-
checkpointer = PostgresSaver(
|
54
|
-
serializer=PickleCheckpointSerializer(),
|
55
|
-
sync_connection=pool,
|
56
|
-
)
|
57
|
-
|
58
|
-
# Set up the langgraph workflow with the checkpointer
|
59
|
-
workflow = ... # Fill in with your workflow
|
60
|
-
app = workflow.compile(checkpointer=checkpointer)
|
61
|
-
|
62
|
-
# Use with the sync methods of `app` (e.g., `app.stream())
|
63
|
-
|
64
|
-
pool.close() # Remember to close the connection pool.
|
65
|
-
```
|
66
|
-
|
67
|
-
Async usage:
|
26
|
+
## Change Log
|
68
27
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
PostgresSaver, PickleCheckpointSerializer
|
73
|
-
)
|
74
|
-
|
75
|
-
pool = AsyncConnectionPool(
|
76
|
-
# Example configuration
|
77
|
-
conninfo="postgresql://langchain:langchain@localhost:6024/langchain",
|
78
|
-
max_size=20,
|
79
|
-
)
|
80
|
-
|
81
|
-
# Create the tables in postgres (only needs to be done once)
|
82
|
-
await PostgresSaver.acreate_tables(pool)
|
83
|
-
|
84
|
-
checkpointer = PostgresSaver(
|
85
|
-
serializer=PickleCheckpointSerializer(),
|
86
|
-
async_connection=pool,
|
87
|
-
)
|
88
|
-
|
89
|
-
# Set up the langgraph workflow with the checkpointer
|
90
|
-
workflow = ... # Fill in with your workflow
|
91
|
-
app = workflow.compile(checkpointer=checkpointer)
|
92
|
-
|
93
|
-
# Use with the async methods of `app` (e.g., `app.astream()`)
|
94
|
-
|
95
|
-
await pool.close() # Remember to close the connection pool.
|
96
|
-
```
|
97
|
-
|
98
|
-
#### Testing
|
99
|
-
|
100
|
-
If testing with the postgres checkpointer it may be useful to both create and
|
101
|
-
drop the tables before and after the tests.
|
102
|
-
|
103
|
-
```python
|
104
|
-
from psycopg_pool import ConnectionPool
|
105
|
-
from langchain_postgres import (
|
106
|
-
PostgresSaver
|
107
|
-
)
|
108
|
-
with ConnectionPool(
|
109
|
-
# Example configuration
|
110
|
-
conninfo="postgresql://langchain:langchain@localhost:6024/langchain",
|
111
|
-
max_size=20,
|
112
|
-
) as conn:
|
113
|
-
PostgresSaver.create_tables(conn)
|
114
|
-
PostgresSaver.drop_tables(conn)
|
115
|
-
# Run your unit tests with langgraph
|
116
|
-
```
|
28
|
+
0.0.6:
|
29
|
+
- Remove langgraph as a dependency as it was causing dependency conflicts.
|
30
|
+
- Base interface for checkpointer changed in langgraph, so existing implementation would've broken regardless.
|
117
31
|
|
32
|
+
## Usage
|
118
33
|
|
119
34
|
### ChatMessageHistory
|
120
35
|
|
@@ -1,11 +1,6 @@
|
|
1
1
|
from importlib import metadata
|
2
2
|
|
3
3
|
from langchain_postgres.chat_message_histories import PostgresChatMessageHistory
|
4
|
-
from langchain_postgres.checkpoint import (
|
5
|
-
CheckpointSerializer,
|
6
|
-
PickleCheckpointSerializer,
|
7
|
-
PostgresSaver,
|
8
|
-
)
|
9
4
|
from langchain_postgres.vectorstores import PGVector
|
10
5
|
|
11
6
|
try:
|
@@ -16,9 +11,6 @@ except metadata.PackageNotFoundError:
|
|
16
11
|
|
17
12
|
__all__ = [
|
18
13
|
"__version__",
|
19
|
-
"CheckpointSerializer",
|
20
14
|
"PostgresChatMessageHistory",
|
21
|
-
"PostgresSaver",
|
22
|
-
"PickleCheckpointSerializer",
|
23
15
|
"PGVector",
|
24
16
|
]
|