QdrantReader#
- class llama_index.readers.QdrantReader(location: Optional[str] = None, url: Optional[str] = None, port: Optional[int] = 6333, grpc_port: int = 6334, prefer_grpc: bool = False, https: Optional[bool] = None, api_key: Optional[str] = None, prefix: Optional[str] = None, timeout: Optional[float] = None, host: Optional[str] = None, path: Optional[str] = None)#
Bases:
BaseReader
Qdrant reader.
Retrieve documents from existing Qdrant collections.
- Parameters
location – If :memory: - use in-memory Qdrant instance. If str - use it as a url parameter. If None - use default values for host and port.
url – either host or str of “Optional[scheme], host, Optional[port], Optional[prefix]”. Default: None
port – Port of the REST API interface. Default: 6333
grpc_port – Port of the gRPC interface. Default: 6334
prefer_grpc – If true - use gPRC interface whenever possible in custom methods.
https – If true - use HTTPS(SSL) protocol. Default: false
api_key – API key for authentication in Qdrant Cloud. Default: None
prefix – If not None - add prefix to the REST URL path. Example: service/v1 will result in http://localhost:6333/service/v1/{qdrant-endpoint} for REST API. Default: None
timeout – Timeout for REST and gRPC API requests. Default: 5.0 seconds for REST and unlimited for gRPC
host – Host name of Qdrant service. If url and host are None, set to ‘localhost’. Default: None
Methods Summary
load_data
(collection_name, query_vector[, ...])Load data from Qdrant.
Methods Documentation
- load_data(collection_name: str, query_vector: List[float], should_search_mapping: Optional[Dict[str, str]] = None, must_search_mapping: Optional[Dict[str, str]] = None, must_not_search_mapping: Optional[Dict[str, str]] = None, rang_search_mapping: Optional[Dict[str, Dict[str, float]]] = None, limit: int = 10) List[Document] #
Load data from Qdrant.
- Parameters
collection_name (str) – Name of the Qdrant collection.
query_vector (List[float]) – Query vector.
should_search_mapping (Optional[Dict[str, str]]) – Mapping from field name to query string.
must_search_mapping (Optional[Dict[str, str]]) – Mapping from field name to query string.
must_not_search_mapping (Optional[Dict[str, str]]) – Mapping from field name to query string.
rang_search_mapping (Optional[Dict[str, Dict[str, float]]]) – Mapping from field name to range query.
limit (int) – Number of results to return.
Example
reader = QdrantReader() reader.load_data(
collection_name=”test_collection”, 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”}, # gte, lte, gt, lt supported rang_search_mapping={“text_field”: {“gte”: 0.1, “lte”: 0.2}}, limit=10
)
- Returns
A list of documents.
- Return type
List[Document]