Skip to main content

Setup

Create an index in the Upstash Console, then copy its REST URL and token.
The example uses OpenAI for the agent model, so set your API key:

Example

agent_with_knowledge.py
Without an embedder, UpstashVectorDb uses Upstash’s hosted embedding models. Create your index with an embedding model in the Upstash Console. To embed locally instead, pass an embedder and make sure its dimension matches the index.

Async Support ⚡

Upstash also supports asynchronous operations, enabling concurrency and leading to better performance.

async_upstash_db.py
Use ainsert() and aprint_response() methods with asyncio.run() for non-blocking operations in high-throughput applications.

UpstashVectorDb Params