Qdrant Store for Retrieval Augmented Generation (RAG)

When implementing Retrieval Augmented Generation (RAG), a robust document store is crucial. This guide demonstrates how to leverage a Qdrant database as the document store.

Leveraging the Qdrant Document Store

To make use of the Qdrant document store, you’ll need to include the following dependency:

<dependency>
    <groupId>io.quarkiverse.langchain4j</groupId>
    <artifactId>quarkus-langchain4j-qdrant</artifactId>
</dependency>

Configuration Settings

Customize the behavior of the extension by exploring various configuration options:

Configuration property fixed at build time - All other configuration properties are overridable at runtime

Configuration property

Type

Default

Whether Dev Services for Qdrant are enabled or not.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_DEVSERVICES_ENABLED

boolean

true

Container image for Qdrant.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_DEVSERVICES_QDRANT_IMAGE_NAME

string

docker.io/qdrant/qdrant:v1.8.3-unprivileged

Optional fixed port the Qdrant dev service will listen to. If not defined, the port will be chosen randomly.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_DEVSERVICES_PORT

int

Indicates if the Dev Service containers managed by Quarkus for Qdrant are shared.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_DEVSERVICES_SHARED

boolean

true

Service label to apply to created Dev Services containers.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_DEVSERVICES_SERVICE_NAME

string

qdrant

Distance function used for comparing vectors

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_DEVSERVICES_COLLECTION_VECTOR_PARAMS_DISTANCE

unknown-distance, cosine, euclid, dot, manhattan

required

Size of the vectors

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_DEVSERVICES_COLLECTION_VECTOR_PARAMS_SIZE

long

0l

The URL of the Qdrant server.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_HOST

string

required

The gRPC port of the Qdrant server. Defaults to 6334

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_PORT

int

6334

The Qdrant API key to authenticate with.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_API_KEY

string

Whether to use TLS(HTTPS). Defaults to false.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_USE_TLS

boolean

false

The field name of the text segment in the payload. Defaults to "text_segment"

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_PAYLOAD_TEXT_KEY

string

text_segment

The name of the collection.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_COLLECTION_NAME

string

required

Dev Services

To use the Qdrant Dev Services, 3 configuration properties are required:

  • quarkus.langchain4j.qdrant.devservices.service-name which specifies the name of the collection to create

  • quarkus.langchain4j.qdrant.devservices.collection.vector-params.distance which specifies the distance function used for comparing vectors

  • quarkus.langchain4j.qdrant.devservices.collection.vector-params.size which specifies the size of the vectors.