Skip to content

Commit c686ab4

Browse files
authored
docs: add github links (#51)
1 parent a71c859 commit c686ab4

3 files changed

Lines changed: 19 additions & 3 deletions

File tree

docs/chat_message_history.ipynb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"\n",
1313
"This notebook goes over how to use [Memorystore for Redis](https://cloud.google.com/memorystore/docs/redis/memorystore-for-redis-overview) to store chat message history with the `MemorystoreChatMessageHistory` class.\n",
1414
"\n",
15+
"Learn more about the package on [GitHub](https://github.com/googleapis/langchain-google-memorystore-redis-python/).\n",
16+
"\n",
1517
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/googleapis/langchain-google-memorystore-redis-python/blob/main/docs/chat_message_history.ipynb)"
1618
]
1719
},
@@ -22,7 +24,9 @@
2224
"## Before You Begin\n",
2325
"\n",
2426
"To run this notebook, you will need to do the following:\n",
27+
"\n",
2528
"* [Create a Google Cloud Project](https://developers.google.com/workspace/guides/create-project)\n",
29+
"* [Enable the Memorystore for Redis API](https://console.cloud.google.com/flows/enableapi?apiid=redis.googleapis.com)\n",
2630
"* [Create a Memorystore for Redis instance](https://cloud.google.com/memorystore/docs/redis/create-instance-console). Ensure that the version is greater than or equal to 5.0.\n",
2731
"\n",
2832
"After confirmed access to database in the runtime environment of this notebook, filling the following values and run the cell before running example scripts."

docs/document_loader.ipynb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"\n",
1313
"This notebook goes over how to use [Memorystore for Redis](https://cloud.google.com/memorystore/docs/redis/memorystore-for-redis-overview) to [save, load and delete langchain documents](https://python.langchain.com/docs/modules/data_connection/document_loaders/) with `MemorystoreDocumentLoader` and `MemorystoreDocumentSaver`.\n",
1414
"\n",
15+
"Learn more about the package on [GitHub](https://github.com/googleapis/langchain-google-memorystore-redis-python/).\n",
16+
"\n",
1517
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/googleapis/langchain-google-memorystore-redis-python/blob/main/docs/document_loader.ipynb)"
1618
]
1719
},
@@ -22,7 +24,9 @@
2224
"## Before You Begin\n",
2325
"\n",
2426
"To run this notebook, you will need to do the following:\n",
27+
"\n",
2528
"* [Create a Google Cloud Project](https://developers.google.com/workspace/guides/create-project)\n",
29+
"* [Enable the Memorystore for Redis API](https://console.cloud.google.com/flows/enableapi?apiid=redis.googleapis.com)\n",
2630
"* [Create a Memorystore for Redis instance](https://cloud.google.com/memorystore/docs/redis/create-instance-console). Ensure that the version is greater than or equal to 5.0.\n",
2731
"\n",
2832
"After confirmed access to database in the runtime environment of this notebook, filling the following values and run the cell before running example scripts."
@@ -144,6 +148,7 @@
144148
"### Save documents\n",
145149
"\n",
146150
"Save langchain documents with `MemorystoreDocumentSaver.add_documents(<documents>)`. To initialize `MemorystoreDocumentSaver` class you need to provide 2 things:\n",
151+
"\n",
147152
"1. `client` - A `redis.Redis` client object.\n",
148153
"1. `key_prefix` - A prefix for the keys to store Documents in Redis.\n",
149154
"\n",
@@ -156,6 +161,8 @@
156161
"metadata": {},
157162
"outputs": [],
158163
"source": [
164+
"import redis\n",
165+
"from langchain_core.documents import Document\n",
159166
"from langchain_google_memorystore_redis import MemorystoreDocumentSaver\n",
160167
"\n",
161168
"test_docs = [\n",
@@ -180,7 +187,7 @@
180187
" key_prefix=KEY_PREFIX,\n",
181188
" content_field=\"page_content\",\n",
182189
")\n",
183-
"saver.add_documents(test_docs, ids=docs_ids)"
190+
"saver.add_documents(test_docs, ids=doc_ids)"
184191
]
185192
},
186193
{
@@ -194,6 +201,7 @@
194201
"Initialize a loader that loads all documents stored in the Memorystore for Redis instance with a specific prefix.\n",
195202
"\n",
196203
"Load langchain documents with `MemorystoreDocumentLoader.load()` or `MemorystoreDocumentLoader.lazy_load()`. `lazy_load` returns a generator that only queries database during the iteration. To initialize `MemorystoreDocumentLoader` class you need to provide:\n",
204+
"\n",
197205
"1. `client` - A `redis.Redis` client object.\n",
198206
"1. `key_prefix` - A prefix for the keys to store Documents in Redis."
199207
]
@@ -274,7 +282,7 @@
274282
"source": [
275283
"loader = MemorystoreDocumentLoader(\n",
276284
" client=redis_client,\n",
277-
" key_prefix=prefix,\n",
285+
" key_prefix=KEY_PREFIX,\n",
278286
" content_fields=set([\"content_field_1\", \"content_field_2\"]),\n",
279287
" metadata_fields=set([\"title\", \"author\"]),\n",
280288
")"

docs/vector_store.ipynb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"\n",
1212
"This notebook goes over how to use [Memorystore for Redis](https://cloud.google.com/memorystore/docs/redis/memorystore-for-redis-overview) to store vector embeddings with the `MemorystoreVectorStore` class.\n",
1313
"\n",
14+
"Learn more about the package on [GitHub](https://github.com/googleapis/langchain-google-memorystore-redis-python/).\n",
15+
"\n",
1416
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/googleapis/langchain-google-memorystore-redis-python/blob/main/docs/vector_store.ipynb)"
1517
]
1618
},
@@ -29,7 +31,9 @@
2931
"## Before You Begin\n",
3032
"\n",
3133
"To run this notebook, you will need to do the following:\n",
34+
"\n",
3235
"* [Create a Google Cloud Project](https://developers.google.com/workspace/guides/create-project)\n",
36+
"* [Enable the Memorystore for Redis API](https://console.cloud.google.com/flows/enableapi?apiid=redis.googleapis.com)\n",
3337
"* [Create a Memorystore for Redis instance](https://cloud.google.com/memorystore/docs/redis/create-instance-console). Ensure that the version is greater than or equal to 7.2."
3438
]
3539
},
@@ -51,7 +55,7 @@
5155
},
5256
"outputs": [],
5357
"source": [
54-
"%pip install -upgrade --quiet langchain-google-memorystore-redis"
58+
"%pip install -upgrade --quiet langchain-google-memorystore-redis langchain"
5559
]
5660
},
5761
{

0 commit comments

Comments
 (0)