Commit 98c2f8f
feat(graph): add Spanner Graph support to LangChain GraphStore interface (googleapis#104)
* feat(graph): add Spanner Graph support to LangChain GraphStore interface
1) Add SpannerGraphStore implementation of GraphStore;
2) Add an integration test;
3) Add a notebook to demonstrate the usage;
4) Misc updates: requirements, __init__
* Allow more flexible input that can generated by LLMs
1) same edge label between different types of nodes
E.g.
Company FOCUS_ON Product
Company FOCUS_ON Technology
2) the same doc contains multiple nodes/edges with the same key fields.
E.g.
Merge
Company(id='Google', properties={'p1':'a1', 'p3':'a3'}),
Company(id='Google', properties={'p2':'a2', 'p3':'a4'})
into
Company(id='Google', properties={'p1':'a1', 'p2':'a2', 'p3':'a4'})
This is due to Spanner DML doesn't support updating the same row twice
in the same DML. We could also separate each node/edge into a separate
DML which can be very slow.
* style: formatting
* style: formatting
* Address various review feedbacks
1) Fix style of python notebook;
2) GraphStore:
- improve a corner case by avoiding full set iteration;
- add some null checking;
- move utilities around.
* Format the notebook
* Fix linter error
* Fix type annotation
* Use batch table insertion API instead of transaction DML API
* Minor fixes & cleanups: colab, requirements, tests, schema corner cases
---------
Co-authored-by: Gaurav Purohit <[email protected]>
Co-authored-by: gauravpurohit <[email protected]>1 parent cb9ba08 commit 98c2f8f
File tree
6 files changed
+2377
-0
lines changed- docs
- src/langchain_google_spanner
- tests/integration
6 files changed
+2377
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
134 | 155 | | |
135 | 156 | | |
136 | 157 | | |
| |||
0 commit comments