LangChain for Java

LangChain for Java, also known as Langchain4J, is a community port of Langchain for building context-aware AI applications in Java

You can use Qdrant as a vector store in Langchain4J through the langchain4j-qdrant module.


Add the langchain4j-qdrant to your project dependencies.



Before you use the following code sample, customize the following values for your configuration:

  • YOUR_COLLECTION_NAME: Use our Collections guide to create or list collections.
  • YOUR_HOST_URL: Use the GRPC URL for your system. If you used the Quick Start guide, it may be http://localhost:6334. If you’ve deployed in the Qdrant Cloud, you may have a longer URL such as
  • YOUR_API_KEY: Substitute the API key associated with your configuration.

EmbeddingStore<TextSegment> embeddingStore =
        // Ensure the collection is configured with the appropriate dimensions
        // of the embedding model.
        // Reference
        // GRPC port of the Qdrant server

QdrantEmbeddingStore supports all the semantic features of Langchain4J.

Further Reading