Query Qdrant Collections with LlamaIndex
LlamaIndex reader that retrieves documents from a Qdrant collection by vector similarity.
Why it matters
Integrate LlamaIndex with Qdrant to efficiently retrieve documents from existing Qdrant collections. This enables powerful similarity search and data retrieval for AI applications.
Outcomes
What it gets done
Connect to Qdrant instances using various authentication and connection parameters.
Load documents from specified Qdrant collections.
Perform similarity searches using query vectors.
Map search fields for precise data retrieval.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/li-reader-readers-qdrant | bash Overview
LlamaIndex Readers Integration: Qdrant
The Qdrant Reader retrieves documents from a Qdrant collection by vector similarity, filterable with should/must/must-not field conditions and numeric range conditions. Use it when you have an existing, reachable Qdrant instance and need documents retrieved by vector similarity with field-level filtering.
What it does
The Qdrant Reader retrieves documents from existing Qdrant collections. Qdrant is a similarity search engine for efficiently searching and retrieving similar items from large datasets based on vector embeddings.
When to use - and when NOT to
Use it when you have an existing Qdrant collection and need to retrieve documents from it by vector similarity, with fine-grained filtering (should, must, and must-not conditions, plus range conditions on specific fields). It reads from an existing collection using connection details (location, URL, host, port, gRPC port, API key, and more), so it is not usable without a reachable Qdrant instance.
Inputs and outputs
Install with:
pip install llama-index-readers-qdrant
Initialize with your Qdrant connection details, then load by collection and query vector:
from llama_index.readers.qdrant import QdrantReader
reader = QdrantReader(
location="<Qdrant Location>",
url="<Qdrant URL>",
port="<Port>",
grpc_port="<gRPC Port>",
prefer_grpc="<Prefer gRPC>",
https="<Use HTTPS>",
api_key="<API Key>",
prefix="<URL Prefix>",
timeout="<Timeout>",
host="<Host>",
)
documents = reader.load_data(
collection_name="<Collection Name>",
query_vector=[0.1, 0.2, 0.3],
should_search_mapping={"text_field": "text"},
must_search_mapping={"text_field": "text"},
must_not_search_mapping={"text_field": "text"},
rang_search_mapping={"text_field": {"gte": 0.1, "lte": 0.2}},
limit=10,
)
load_data filters results with should_search_mapping, must_search_mapping, and must_not_search_mapping (field-based should/must/must-not conditions), plus rang_search_mapping for numeric range conditions like gte/lte, alongside the query_vector, collection_name, and a result limit.
Who it's for
Developers building LlamaIndex or LangChain pipelines that need documents retrieved from an existing Qdrant collection by vector similarity with field-level filtering.
Source README
LlamaIndex Readers Integration: Qdrant
Overview
The Qdrant Reader allows you to retrieve documents from existing Qdrant collections. Qdrant is a similarity search engine that helps you efficiently search and retrieve similar items from large datasets based on vector embeddings.
For more detailed information about Qdrant, visit Qdrant
Installation
You can install the Qdrant Reader via pip:
pip install llama-index-readers-qdrant
Usage
from llama_index.readers.qdrant import QdrantReader
### Initialize QdrantReader
reader = QdrantReader(
location="<Qdrant Location>",
url="<Qdrant URL>",
port="<Port>",
grpc_port="<gRPC Port>",
prefer_grpc="<Prefer gRPC>",
https="<Use HTTPS>",
api_key="<API Key>",
prefix="<URL Prefix>",
timeout="<Timeout>",
host="<Host>",
)
### Load data from Qdrant
documents = reader.load_data(
collection_name="<Collection Name>",
query_vector=[0.1, 0.2, 0.3],
should_search_mapping={"text_field": "text"},
must_search_mapping={"text_field": "text"},
must_not_search_mapping={"text_field": "text"},
rang_search_mapping={"text_field": {"gte": 0.1, "lte": 0.2}},
limit=10,
)
This loader is designed to be used as a way to load data into
LlamaIndex and/or subsequently
used as a Tool in a LangChain Agent.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.