Skip to content

Commit 467cfa3

Browse files
authored
docs: update vector store doc (#37)
1 parent 03b2870 commit 467cfa3

1 file changed

Lines changed: 83 additions & 11 deletions

File tree

docs/vector_store.ipynb

Lines changed: 83 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@
55
"cell_type": "markdown",
66
"metadata": {},
77
"source": [
8-
"Google Database\n",
8+
"# Google Memorystore for Redis\n",
99
"\n",
10-
"Use [Google Memorystore for Redis](https://cloud.google.com/memorystore/docs/redis/memorystore-for-redis-overview) as a vector store for LangChain."
10+
"> [Google Memorystore for Redis](https://cloud.google.com/memorystore/docs/redis/memorystore-for-redis-overview) is a fully-managed service that is powered by the Redis in-memory data store to build application caches that provide sub-millisecond data access. Extend your database application to build AI-powered experiences leveraging Memorystore for Redis's Langchain integrations.\n",
11+
"\n",
12+
"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",
13+
"\n",
14+
"[![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)"
1115
]
1216
},
1317
{
@@ -22,22 +26,21 @@
2226
"cell_type": "markdown",
2327
"metadata": {},
2428
"source": [
25-
"### Setting Up a Memorystore for Redis Instance\n",
29+
"## Before You Begin\n",
2630
"\n",
27-
"Before proceeding, an active Memorystore for Redis instance is needed to store vectors:\n",
28-
"\n",
29-
"* Create a Memorystore for Redis Instance (v7.2): If an instance doesn't exist, follow the instructions at https://cloud.google.com/memorystore/docs/redis/create-instance-console to create a new one. Ensure version 7.2 is selected.\n",
30-
"* Obtain Endpoint: Note the endpoint associated with the instance."
31+
"To run this notebook, you will need to do the following:\n",
32+
"* [Create a Google Cloud Project](https://developers.google.com/workspace/guides/create-project)\n",
33+
"* [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."
3134
]
3235
},
3336
{
3437
"attachments": {},
3538
"cell_type": "markdown",
3639
"metadata": {},
3740
"source": [
38-
"### Installing the LangChain Memorystore for Redis Module\n",
41+
"### 🦜🔗 Library Installation\n",
3942
"\n",
40-
"Interaction with the Memorystore for Redis instance from LangChain requires installing the necessary module:"
43+
"The integration lives in its own `langchain-google-memorystore-redis` package, so we need to install it."
4144
]
4245
},
4346
{
@@ -48,8 +51,77 @@
4851
},
4952
"outputs": [],
5053
"source": [
51-
"# Install Memorystore for Redis for LangChain module\n",
52-
"%pip install langchainlangchain_google_memorystore_redis"
54+
"%pip install -upgrade --quiet langchain-google-memorystore-redis"
55+
]
56+
},
57+
{
58+
"cell_type": "markdown",
59+
"metadata": {},
60+
"source": [
61+
"**Colab only:** Uncomment the following cell to restart the kernel or use the button to restart the kernel. For Vertex AI Workbench you can restart the terminal using the button on top."
62+
]
63+
},
64+
{
65+
"cell_type": "code",
66+
"execution_count": null,
67+
"metadata": {},
68+
"outputs": [],
69+
"source": [
70+
"# # Automatically restart kernel after installs so that your environment can access the new packages\n",
71+
"# import IPython\n",
72+
"\n",
73+
"# app = IPython.Application.instance()\n",
74+
"# app.kernel.do_shutdown(True)"
75+
]
76+
},
77+
{
78+
"cell_type": "markdown",
79+
"metadata": {},
80+
"source": [
81+
"### ☁ Set Your Google Cloud Project\n",
82+
"Set your Google Cloud project so that you can leverage Google Cloud resources within this notebook.\n",
83+
"\n",
84+
"If you don't know your project ID, try the following:\n",
85+
"\n",
86+
"* Run `gcloud config list`.\n",
87+
"* Run `gcloud projects list`.\n",
88+
"* See the support page: [Locate the project ID](https://support.google.com/googleapi/answer/7014113)."
89+
]
90+
},
91+
{
92+
"cell_type": "code",
93+
"execution_count": null,
94+
"metadata": {},
95+
"outputs": [],
96+
"source": [
97+
"# @markdown Please fill in the value below with your Google Cloud project ID and then run the cell.\n",
98+
"\n",
99+
"PROJECT_ID = \"my-project-id\" # @param {type:\"string\"}\n",
100+
"\n",
101+
"# Set the project id\n",
102+
"!gcloud config set project {PROJECT_ID}"
103+
]
104+
},
105+
{
106+
"cell_type": "markdown",
107+
"metadata": {},
108+
"source": [
109+
"### 🔐 Authentication\n",
110+
"Authenticate to Google Cloud as the IAM user logged into this notebook in order to access your Google Cloud Project.\n",
111+
"\n",
112+
"* If you are using Colab to run this notebook, use the cell below and continue.\n",
113+
"* If you are using Vertex AI Workbench, check out the setup instructions [here](https://github.com/GoogleCloudPlatform/generative-ai/tree/main/setup-env)."
114+
]
115+
},
116+
{
117+
"cell_type": "code",
118+
"execution_count": null,
119+
"metadata": {},
120+
"outputs": [],
121+
"source": [
122+
"from google.colab import auth\n",
123+
"\n",
124+
"auth.authenticate_user()"
53125
]
54126
},
55127
{

0 commit comments

Comments
 (0)