Skip to content

Commit

Permalink
docs: add github links (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
averikitsch committed Mar 7, 2024
1 parent a71c859 commit c686ab4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/chat_message_history.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"\n",
"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",
"\n",
"Learn more about the package on [GitHub](https://github.com/googleapis/langchain-google-memorystore-redis-python/).\n",
"\n",
"[![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)"
]
},
Expand All @@ -22,7 +24,9 @@
"## Before You Begin\n",
"\n",
"To run this notebook, you will need to do the following:\n",
"\n",
"* [Create a Google Cloud Project](https://developers.google.com/workspace/guides/create-project)\n",
"* [Enable the Memorystore for Redis API](https://console.cloud.google.com/flows/enableapi?apiid=redis.googleapis.com)\n",
"* [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",
"\n",
"After confirmed access to database in the runtime environment of this notebook, filling the following values and run the cell before running example scripts."
Expand Down
12 changes: 10 additions & 2 deletions docs/document_loader.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"\n",
"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",
"\n",
"Learn more about the package on [GitHub](https://github.com/googleapis/langchain-google-memorystore-redis-python/).\n",
"\n",
"[![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)"
]
},
Expand All @@ -22,7 +24,9 @@
"## Before You Begin\n",
"\n",
"To run this notebook, you will need to do the following:\n",
"\n",
"* [Create a Google Cloud Project](https://developers.google.com/workspace/guides/create-project)\n",
"* [Enable the Memorystore for Redis API](https://console.cloud.google.com/flows/enableapi?apiid=redis.googleapis.com)\n",
"* [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",
"\n",
"After confirmed access to database in the runtime environment of this notebook, filling the following values and run the cell before running example scripts."
Expand Down Expand Up @@ -144,6 +148,7 @@
"### Save documents\n",
"\n",
"Save langchain documents with `MemorystoreDocumentSaver.add_documents(<documents>)`. To initialize `MemorystoreDocumentSaver` class you need to provide 2 things:\n",
"\n",
"1. `client` - A `redis.Redis` client object.\n",
"1. `key_prefix` - A prefix for the keys to store Documents in Redis.\n",
"\n",
Expand All @@ -156,6 +161,8 @@
"metadata": {},
"outputs": [],
"source": [
"import redis\n",
"from langchain_core.documents import Document\n",
"from langchain_google_memorystore_redis import MemorystoreDocumentSaver\n",
"\n",
"test_docs = [\n",
Expand All @@ -180,7 +187,7 @@
" key_prefix=KEY_PREFIX,\n",
" content_field=\"page_content\",\n",
")\n",
"saver.add_documents(test_docs, ids=docs_ids)"
"saver.add_documents(test_docs, ids=doc_ids)"
]
},
{
Expand All @@ -194,6 +201,7 @@
"Initialize a loader that loads all documents stored in the Memorystore for Redis instance with a specific prefix.\n",
"\n",
"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",
"\n",
"1. `client` - A `redis.Redis` client object.\n",
"1. `key_prefix` - A prefix for the keys to store Documents in Redis."
]
Expand Down Expand Up @@ -274,7 +282,7 @@
"source": [
"loader = MemorystoreDocumentLoader(\n",
" client=redis_client,\n",
" key_prefix=prefix,\n",
" key_prefix=KEY_PREFIX,\n",
" content_fields=set([\"content_field_1\", \"content_field_2\"]),\n",
" metadata_fields=set([\"title\", \"author\"]),\n",
")"
Expand Down
6 changes: 5 additions & 1 deletion docs/vector_store.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"\n",
"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",
"\n",
"Learn more about the package on [GitHub](https://github.com/googleapis/langchain-google-memorystore-redis-python/).\n",
"\n",
"[![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)"
]
},
Expand All @@ -29,7 +31,9 @@
"## Before You Begin\n",
"\n",
"To run this notebook, you will need to do the following:\n",
"\n",
"* [Create a Google Cloud Project](https://developers.google.com/workspace/guides/create-project)\n",
"* [Enable the Memorystore for Redis API](https://console.cloud.google.com/flows/enableapi?apiid=redis.googleapis.com)\n",
"* [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."
]
},
Expand All @@ -51,7 +55,7 @@
},
"outputs": [],
"source": [
"%pip install -upgrade --quiet langchain-google-memorystore-redis"
"%pip install -upgrade --quiet langchain-google-memorystore-redis langchain"
]
},
{
Expand Down

0 comments on commit c686ab4

Please sign in to comment.