Qdrant Embedding Store
Qdrant is a high-performance vector database optimized for semantic search and Retrieval-Augmented Generation (RAG) workloads. This guide explains how to use Qdrant as a vector-capable document store in Quarkus LangChain4j.
Overview
The quarkus-langchain4j-qdrant
extension allows you to connect to a Qdrant instance, manage collections, and perform vector similarity search using embedded text segments.
Dependency
To enable Qdrant integration, add the following dependency to your Quarkus project:
<dependency>
<groupId>io.quarkiverse.langchain4j</groupId>
<artifactId>quarkus-langchain4j-qdrant</artifactId>
<version>1.0.2</version>
</dependency>
Dev Services Support
The extension includes Dev Services support for Qdrant. In dev and test modes, a containerized Qdrant instance is automatically started and initialized with a default or user-defined collection.
To configure Dev Services for Qdrant, you must set the following properties:
# Required: collection name
quarkus.langchain4j.qdrant.devservices.service-name=my-collection
# Required: vector size (depends on embedding model)
quarkus.langchain4j.qdrant.devservices.collection.vector-params.size=384
# Required: distance metric (e.g., Cosine, Dot, Euclidean)
quarkus.langchain4j.qdrant.devservices.collection.vector-params.distance=Cosine
The vector size must match the output dimension of your embedding model (e.g., 384 for BGE, 1536 for OpenAI’s ada-002). |
Dev Services will use the qdrant/qdrant
Docker image by default and expose the gRPC endpoint.
Connecting to an External Qdrant Instance
If you want to use a remote Qdrant instance instead of Dev Services, disable it and provide the connection parameters:
quarkus.langchain4j.qdrant.host=localhost
quarkus.langchain4j.qdrant.port=6334
quarkus.langchain4j.qdrant.use-grpc=true
quarkus.langchain4j.qdrant.collection.name=my-collection
quarkus.langchain4j.qdrant.collection.vector-params.size=384
quarkus.langchain4j.qdrant.collection.vector-params.distance=Cosine
Configuration
You can customize the behavior of the Qdrant extension using the following 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: |
boolean |
|
Container image for Qdrant. Environment variable: |
string |
|
Optional fixed port the Qdrant dev service will listen to. If not defined, the port will be chosen randomly. Environment variable: |
int |
|
Indicates if the Dev Service containers managed by Quarkus for Qdrant are shared. Environment variable: |
boolean |
|
Service label to apply to created Dev Services containers. Environment variable: |
string |
|
Distance function used for comparing vectors Environment variable: |
|
required |
Size of the vectors Environment variable: |
long |
|
The URL of the Qdrant server. Environment variable: |
string |
required |
The gRPC port of the Qdrant server. Defaults to 6334 Environment variable: |
int |
|
The Qdrant API key to authenticate with. Environment variable: |
string |
|
Whether to use TLS(HTTPS). Defaults to false. Environment variable: |
boolean |
|
The field name of the text segment in the payload. Defaults to "text_segment" Environment variable: |
string |
|
The name of the collection. Environment variable: |
string |
required |