UpstashVectorStore
features and configurations head to the API reference.
Overview
Integration details
Class | Package | PY support | Version |
---|---|---|---|
UpstashVectorStore | @langchain/community | ✅ |
Setup
To use Upstash vector stores, you’ll need to create an Upstash account, create an index, and install the@langchain/community
integration package. You’ll also need to install the @upstash/vector
package as a peer dependency.
This guide will also use OpenAI embeddings, which require you to install the @langchain/openai
integration package. You can also use other supported embeddings models if you wish.
Credentials
Once you’ve set up an index, set the following environment variables:Instantiation
Make sure your index has the same dimension count as your embeddings. The default for OpenAItext-embedding-3-small
is 1536.
Usage with built-in embeddings
To use the built-in Upstash embeddings, you can pass aFakeEmbeddings
instance to the UpstashVectorStore
constructor. This will make the UpstashVectorStore
use the built-in embeddings, which you selected when creating the index.
Manage vector store
Add items to vector store
Delete items from vector store
Query vector store
Once your vector store has been created and the relevant documents have been added you will most likely wish to query it during the running of your chain or agent.Query directly
Performing a simple similarity search can be done as follows:Query by turning into retriever
You can also transform the vector store into a retriever for easier usage in your chains.Usage for retrieval-augmented generation
For guides on how to use this vector store for retrieval-augmented generation (RAG), see the following sections:API reference
For detailed documentation of allUpstashVectorStore
features and configurations head to the API reference.