From 60335e07341181b52bd19f0b109bf28bacf95986 Mon Sep 17 00:00:00 2001 From: ytkimirti Date: Thu, 9 Jan 2025 07:38:49 +0300 Subject: [PATCH] docs: Add docs for Upstash Vector built-in embeddings support (#7485) Co-authored-by: Jacob Lee --- .../integrations/vectorstores/upstash.ipynb | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/docs/core_docs/docs/integrations/vectorstores/upstash.ipynb b/docs/core_docs/docs/integrations/vectorstores/upstash.ipynb index 66b0c7d4c264..2817456b4719 100644 --- a/docs/core_docs/docs/integrations/vectorstores/upstash.ipynb +++ b/docs/core_docs/docs/integrations/vectorstores/upstash.ipynb @@ -64,6 +64,14 @@ "\n", "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", "\n", + "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", + "\n", + "```{=mdx}\n", + ":::note\n", + "To use the built-in Upstash embeddings, you'll need to select an embedding model when creating the index.\n", + ":::\n", + "```\n", + "\n", "### Credentials\n", "\n", "Once you've set up an index, set the following environment variables:\n", @@ -127,6 +135,38 @@ "});" ] }, + { + "cell_type": "markdown", + "id": "afa53a9c", + "metadata": {}, + "source": [ + "## Usage with built-in embeddings\n", + "\n", + "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." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cbabe6f7", + "metadata": {}, + "outputs": [], + "source": [ + "import { UpstashVectorStore } from \"@langchain/community/vectorstores/upstash\";\n", + "import { FakeEmbeddings } from \"@langchain/core/utils/testing\";\n", + "\n", + "import { Index } from \"@upstash/vector\";\n", + "\n", + "const indexWithEmbeddings = new Index({\n", + " url: process.env.UPSTASH_VECTOR_REST_URL,\n", + " token: process.env.UPSTASH_VECTOR_REST_TOKEN,\n", + "});\n", + "\n", + "const vectorStore = new UpstashVectorStore(new FakeEmbeddings(), {\n", + " index: indexWithEmbeddings,\n", + "});" + ] + }, { "cell_type": "markdown", "id": "ac6071d4", @@ -360,4 +400,4 @@ }, "nbformat": 4, "nbformat_minor": 5 -} \ No newline at end of file +}