Qdrant (read: quadrant) is a vector similarity search engine. It provides a production-ready service with a convenient API to store, search, and manage vectors with additional payload and extended filtering support. It makes it useful for all sorts of neural network or semantic-based matching, faceted search, and other applications.This documentation demonstrates how to use Qdrant with LangChain for dense (i.e., embedding-based), sparse (i.e., text search) and hybrid retrieval. The
QdrantVectorStore
class supports multiple retrieval modes via Qdrant’s new Query API. It requires you to run Qdrant v1.10.0 or above.
Qdrant
, and depending on the chosen one, there will be some subtle differences. The options include:
QDRANT_API_KEY
environment variable.
langchain_qdrant.Qdrant
without loading any new documents or texts, you can use the Qdrant.from_existing_collection()
method.
add_documents
function.
QdrantVectorStore
supports 3 modes for similarity searches. They can be configured using the retrieval_mode
parameter.
retrieval_mode
parameter should be set to RetrievalMode.DENSE
. This is the default behavior.embedding
parameter.retrieval_mode
parameter should be set to RetrievalMode.SPARSE
.SparseEmbeddings
interface using any sparse embeddings provider has to be provided as a value to the sparse_embedding
parameter.langchain-qdrant
package provides a FastEmbed based implementation out of the box.
To use it, install the FastEmbed package.
retrieval_mode
parameter should be set to RetrievalMode.HYBRID
.embedding
parameter.SparseEmbeddings
interface using any sparse embeddings provider has to be provided as a value to the sparse_embedding
parameter.HYBRID
mode, you can switch to any retrieval mode when searching, since both the dense and sparse vectors are available in the collection.
QdrantVectorStore
, read the API reference
similarity_search_with_score
and similarity_search
methods.
Document
.
QdrantVectorStore
features and configurations head to the API reference: https://python.langchain.com/api_reference/qdrant/qdrant/langchain_qdrant.qdrant.QdrantVectorStore.html