Skip to content

Commit 60335e0

Browse files
docs: Add docs for Upstash Vector built-in embeddings support (#7485)
Co-authored-by: Jacob Lee <[email protected]>
1 parent 06b45d1 commit 60335e0

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

docs/core_docs/docs/integrations/vectorstores/upstash.ipynb

+41-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@
6464
"\n",
6565
"You can create an index from the [Upstash Console](https://console.upstash.com/login). For further reference, see [the official docs](https://upstash.com/docs/vector/overall/getstarted).\n",
6666
"\n",
67+
"Upstash vector also has built in embedding support. Which means you can use it directly without the need for an additional embedding model. Check the [embedding models documentation](https://upstash.com/docs/vector/features/embeddingmodels) for more details.\n",
68+
"\n",
69+
"```{=mdx}\n",
70+
":::note\n",
71+
"To use the built-in Upstash embeddings, you'll need to select an embedding model when creating the index.\n",
72+
":::\n",
73+
"```\n",
74+
"\n",
6775
"### Credentials\n",
6876
"\n",
6977
"Once you've set up an index, set the following environment variables:\n",
@@ -127,6 +135,38 @@
127135
"});"
128136
]
129137
},
138+
{
139+
"cell_type": "markdown",
140+
"id": "afa53a9c",
141+
"metadata": {},
142+
"source": [
143+
"## Usage with built-in embeddings\n",
144+
"\n",
145+
"To use the built-in Upstash embeddings, you can pass a `FakeEmbeddings` instance to the `UpstashVectorStore` constructor. This will make the `UpstashVectorStore` use the built-in embeddings, which you selected when creating the index."
146+
]
147+
},
148+
{
149+
"cell_type": "code",
150+
"execution_count": null,
151+
"id": "cbabe6f7",
152+
"metadata": {},
153+
"outputs": [],
154+
"source": [
155+
"import { UpstashVectorStore } from \"@langchain/community/vectorstores/upstash\";\n",
156+
"import { FakeEmbeddings } from \"@langchain/core/utils/testing\";\n",
157+
"\n",
158+
"import { Index } from \"@upstash/vector\";\n",
159+
"\n",
160+
"const indexWithEmbeddings = new Index({\n",
161+
" url: process.env.UPSTASH_VECTOR_REST_URL,\n",
162+
" token: process.env.UPSTASH_VECTOR_REST_TOKEN,\n",
163+
"});\n",
164+
"\n",
165+
"const vectorStore = new UpstashVectorStore(new FakeEmbeddings(), {\n",
166+
" index: indexWithEmbeddings,\n",
167+
"});"
168+
]
169+
},
130170
{
131171
"cell_type": "markdown",
132172
"id": "ac6071d4",
@@ -360,4 +400,4 @@
360400
},
361401
"nbformat": 4,
362402
"nbformat_minor": 5
363-
}
403+
}

0 commit comments

Comments
 (0)