This plugin allows services to connect to a Qdrant database. Qdrant is a vector database & vector similarity search engine.

You can get started in seconds by cloning our Axum + Qdrant example with

cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder axum/qdrant

Usage

IMPORTANT: Currently Shuttle isn’t able to provision a Qdrant Cloud cluster for you (yet). This means you will have to create an account on their website and follow the few steps required to create a cluster and an API key to access it.

Add shuttle-qdrant and qdrant-client to the dependencies for your service by running cargo add shuttle-qdrant qdrant-client@1.7.0. This resource will be provided by adding the shuttle_qdrant::Qdrant attribute to your Shuttle main function.

It returns a qdrant_client::QdrantClient. When running locally it will by default spin up a Qdrant Docker container for your project.

If you want to connect to a remote database when running locally, you can specify the local_url parameter.

Parameters

ParameterTypeRequired?Description
cloud_url&strIn deploymentURL of the database to connect to. NOTE: It should use the gRPC port.
api_key&strNoRequired if the database requires an API key.
local_addr&strNoIf specified, connect to this URL on local runs instead of using a Docker container.
Make sure the cloud_url parameter is specifying the gRPC port of the database. This is typically done by adding :6334 at the end.

You can use secrets interpolation to set the URL and API key. See below for an example.

Example

In the case of an Axum server, your main function can look like this:

use qdrant_client::prelude::*;

#[shuttle_runtime::main]
async fn axum(
    #[shuttle_qdrant::Qdrant(cloud_url = "{secrets.CLOUD_URL}", api_key = "{secrets.API_KEY}")]
    qdrant: QdrantClient,
) -> shuttle_axum::ShuttleAxum {
    // set up state and router...
}