diff --git a/docs/chat_message_history.ipynb b/docs/chat_message_history.ipynb index 0ec6baf..f7bb8a8 100644 --- a/docs/chat_message_history.ipynb +++ b/docs/chat_message_history.ipynb @@ -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)" ] }, @@ -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." diff --git a/docs/document_loader.ipynb b/docs/document_loader.ipynb index 3ad4cd5..44abc41 100644 --- a/docs/document_loader.ipynb +++ b/docs/document_loader.ipynb @@ -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)" ] }, @@ -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." @@ -144,6 +148,7 @@ "### Save documents\n", "\n", "Save langchain documents with `MemorystoreDocumentSaver.add_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", @@ -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", @@ -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)" ] }, { @@ -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." ] @@ -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", ")" diff --git a/docs/vector_store.ipynb b/docs/vector_store.ipynb index 6031031..7ae476c 100644 --- a/docs/vector_store.ipynb +++ b/docs/vector_store.ipynb @@ -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)" ] }, @@ -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." ] }, @@ -51,7 +55,7 @@ }, "outputs": [], "source": [ - "%pip install -upgrade --quiet langchain-google-memorystore-redis" + "%pip install -upgrade --quiet langchain-google-memorystore-redis langchain" ] }, {