UPSTASH_VECTOR_REST_URL
and UPSTASH_VECTOR_REST_TOKEN
and paste them to our .env
file. To learn more about index creation, you can check out this page.
Add the following content to your .env
file (replace with your actual URL and token):
upstash-vector
library via PyPI. Additionally, we will install python-dotenv
to load environment variables from the .env
file.
main.py
) and add the following code to perform semantic search using Upstash Vector:
python-dotenv
to load our environment variables and use the Index.from_env()
method to initialize the index client.
upsert()
function inserts these documents into our index. These documents are automatically converted into embeddings. To learn more about Upstash Embedding Models, you can check out this page.
reset()
function clears any existing data in the index.
query()
function returns the top_k
most similar documents to the query along with their metadata if include_metadata
is set to True
.