Christy Jacob

Query Upstash

Upstash Vector provides a powerful vector database designed to handle complex queries and search functionalities. It’s ideal for applications that require fast and efficient handling of vector data.

How does the integration work?

You can utilize a pre-built Appwrite function template to integrate an Upstash Vector database with your app. This setup enables you to store and query vector data efficiently, enhancing your application's search and recommendation features.

How to implement

To implement the Upstash Vector integration, follow these simple steps:

Step 1: Set up the Upstash Vector database

First, create an account on Upstash and set up a new Vector index with your preferred region and embedding model. Once it is ready, copy your endpoint and token from the index’s dashboard for further usage

Upstash vector index

Step 2: Create the Appwrite Function

For this step, you must create an account on Appwrite Cloud or self-host Appwrite if you haven’t already. If you decide to self-host Appwrite, there are additional setup steps to use Appwrite Function templates.

Head over to the Appwrite console, navigate to the Functions page, click the Templates tab, and search for the Upstash function template.

Function template

Add the Upstash endpoint and token you saved in the Variables step. Then, create a new repository with the default branch and root directory settings. You can edit this repository later to update the function logic.

Env variables

Step 3: Test the function

Once the function is ready, visit the Domains tab on the Functions page and copy the domain URL to test the function. Sending a GET (HTTP) Request to this endpoint will add a randomly generated mock embedding and query for the one most similar entry in the database.

Bash
curl DEPLOYED_FUNCTION_DOMAIN \
  -H 'accept: application/json'

You can add other database functionalities by editing the function generated on GitHub.

Read more about Upstash and Appwrite Functions

If you would like to learn more about Upstash and Appwrite Functions, we have some resources that you should visit:

Become a Technology Partner

Join our Technology Partners program to integrate your solutions with Appwrite’s API, enhancing functionality and expanding your reach.

Get Started