Getting Started
upstash-search
is a Python SDK for Upstash AI Search, enabling easier operations on Search Databases.
Using upstash-search
you can:
- Perform AI-powered search queries with or without reranking.
- Upsert documents with metadata to an index.
- Fetch documents by their IDs.
- Delete documents from a database.
- Access database stats.
- Reset everything related to a database.
You can find the GitHub Repository here.
Install
Usage
Initializing the client
There are two pieces of configuration required to use the Upstash search client: a REST token and REST URL. These values can be passed using environment variables or in code through a configuration object. Find your configuration values in the console dashboard.
Using environment variables
The environment variables used to configure the client are the following. You can follow this guide to retrieve credentials.
When these environment variables are set, the client constructor does not require any additional arguments.
Using a configuration object
If you prefer to pass configuration in code, the constructor accepts a config object containing the url
and token
values. This
could be useful if your application needs to interact with multiple databases, each with a different configuration.
Using an Index
The Search
client is for operations that are about manipulating the Search database. With it, you can create indexes which is where you can upsert and search documents.