qdrant-client

qdrantApache-2.0活跃维护

Qdrant 向量搜索引擎的官方 Python 客户端,方便在 Python 项目里接入向量检索,做相似度搜索和 RAG 应用。

Python client for Qdrant vector search engine

v1.20.0发布于 2026-10-22 11:35 UTC1,377star395fork同步于 2026-11-10 11:48 UTC

怎么上手

由 README 提炼,执行前请确认
pip install qdrant-client
pip install 'qdrant-client[fastembed]'
硬件要求按 README 说明

README 未说明显存要求;本地模式可在 CPU 上运行,FastEmbed 基于 ONNX Runtime 支持 CPU 与 GPU,GPU 需安装 fastembed-gpu 并在 Document 中设置 options={"cuda": True}

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

Qdrant 向量搜索引擎的 Python 客户端,支持本地内存模式与远程服务,方便快速接入向量检索

Qdrant 向量搜索引擎的官方 Python 客户端,方便在 Python 项目里接入向量检索,做相似度搜索和 RAG 应用。

核心能力

  • 为全部 Qdrant API 提供类型提示
  • 支持 REST 与 gRPC 两种传输方式
  • 用 :memory: 或本地路径免服务器运行
  • 提供 AsyncQdrantClient 全异步接口
  • 集成 FastEmbed 在本地生成向量嵌入

容易踩的坑

fastembed 与 fastembed-gpu 互斥,只能装其中一个,装过 fastembed 需换干净环境再装 GPU 版;远程推理需 Qdrant Cloud 付费计划且图片要以 base64 或 URL 提供;逐条 upsert 请求开销大,大批量应改用 upload_collection 或 upload_points

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v1.20.0
  1. v1.20.0最新正式版2026-10-22 · 2026-10-22 11:35 UTC

    Change Log

    Highlights 🔦

    Qdrant 1.20 🎃

    BM25 is now supported through TextQuery: set scoring on a text index and rank points by how well that field matches the query text. Local mode supports it only for text indexes with the default tokenization. Formulas get the max, min, and acosh expressions.

    The new MatchSubstring condition finds keyword values that contain a given string, using a keyword index. Payload indexes can be nested, indexing every object of an array as its own entry: with nested: offers, a text index on offers[].description matches and BM25-scores each offer separately.

    Performance 🐺

    With pydantic v2, parsing REST responses with vectors is about 2x quicker, and about 3x with the orjson extra (pip install 'qdrant-client[orjson]'). On protobuf 6.30 and later, gRPC writes with payloads are up to about 3x quicker.

    PointStruct, PointVectors, and Batch are much quicker to build from numpy vectors, and parallel uploads of numpy arrays over REST barely add to the main process's memory.

    Behavior Changes 🎭

    • On macOS, parallel uploads and parallel local inference start workers with spawn instead of forkserver, which crashed on Python 3.15. Pass method="forkserver" to upload_points or upload_collection to keep the old start method (#1551, #1568).
    • REST path params are percent-encoded, so names with /, #, %, or ? address the right collection, and names that are exactly . or .. raise ValueError (#1291).
    • Uploads raise ValueError when ids or payload is shorter than the vectors, when parallel is negative, or when auth_token_provider is async. parallel=0 uses all CPU cores (#1578, #1531, #1520).

    Features 🍬

    • #1610 - support Qdrant v1.20: BM25 text queries (TextQuery) with scoring on text indexes, MatchSubstring, max, min, and acosh formula expressions, nested payload indexes, id_tracker collection config, turbo8 and turbo16 datatypes, and the code tokenizer; migrate keeps the payload and id_tracker collection params by @joein
    • #1565, #1566 - skip re-validation of vectors and payloads when parsing REST responses on pydantic v2, and add an orjson extra for faster decoding by @joein
    • #1513, #1514, #1562 - speed up gRPC payload conversion in both directions, especially on protobuf >= 6.30, send numpy vectors as raw bytes in gRPC uploads, and skip float lists when looking for inference objects by @joein
    • #1561 - convert numpy vectors to lists before validation in PointStruct, PointVectors, and Batch by @joein
    • #1558 - bump fastembed to 0.9.0 by @joein
    • #1555 - cut main process memory of parallel uploads by @joein
    • #1519 - add with_ to get_optimizations to request queued, completed, and idle_segments, and request completed when completed_limit is set by @joein

    Fixes 🚑

    • #1605, #1617 - default the text index tokenizer to word in create_payload_index, and convert WriteOrdering in create_payload_index and delete_payload_index over gRPC by @feiiiiii5, @astroknot-sheep, @joein
    • #1602 - return None instead of {} for absent collection metadata over gRPC by @feiiiiii5, @joein
    • #1590 - remove broken request_sync from ApiClient and AsyncApiClient by @joein
    • #1553, #1588 - reset embedder state after a failed or abandoned embed_models_batch, and pass local_inference_batch_size to query embedding in local inference by @moneebullah25, @RAMZI0TO99, @joein
    • #1545, #1578 - reject Batch columns of different lengths in local mode and over gRPC, and ids or payload shorter than vectors in upload_collection by @fhgffy, @joein
    • #1572 - keep empty points lists in batch payload and vector updates over gRPC instead of falling back to filter by @joein
    • #1490, #1563, #1570 - copy collection metadata in migrate, validate its batch_size before touching the destination, and drop its own retry loop, since `upload_points
  2. v1.19.12026-09-16 · 2026-09-16 08:24 UTC
    查看更新说明

    Change Log

    Features 🌊

    • #1419 - token-aware MatchAny in local mode, matching the server by @joein

    Fixes 🧑‍🔧

    • #1440 - fix async client timeout by @joein
    • #1438 - isolate payload values across wildcard targets in local mode by @HaokaiDing, @joein
    • #1427 - update IDF statistics on deletion and reject writes to absent points in local mode by @pentaoa, @joein
    • #1424 - isolate sparse vectors at storage boundaries in local mode by @pentaoa, @joein
    • #1434 - honor str and non-list Sequence with_payload/with_vectors selectors in local mode by @betacatsling, @joein
    • #1429 - reject 0 raised to a negative exponent in formula PowExpression by @bijay-odyssey, @joein
    • #1425 - ignore nonnumeric and reject nonfinite coordinates in geo filters by @pentaoa, @joein
    • #1420 - apply the MMR offset to the re-ranked output instead of the candidates by @2sumtech, @joein
    • #1418 - fix start_from with a date object by @joein
    • #1417 - fix naive datetime and exact datetime precision in order_by by @joein, @Nimra3261
    • #1416 - skip bool payload values in order_by to match server semantics by @feiiiiii5, @joein
    • #1414 - skip bool group-by keys to match server GroupId semantics by @feiiiiii5, @joein
    • #1412 - fix the off-by-one upper bound in the slice index error message by @nazsats, @joein
    • #1408 - keep an absent UpdateResult.operation_id and CollectionInfo.points_count as None over gRPC by @2sumtech, @joein
    • #1407 - honor nested json-path keys in delete_payload by @winklemad, @joein
    • #1405 - do not accept empty vectors and multivectors in local mode by @joein
    • #1402 - match core's MMR tie-breaking by @joein
    • #1401 - accept a bare point id as a prefetch query in local mode by @joein
    • #1399 - fix missing multivector placeholder in local mode by @joein
    • #1398 - fix is_integer usage in the local mode formula API by @joein
    • #1397 - fix local single prefetch by @joein
    • #1394 - mirror the server's token-aware text/phrase matching and array-aware IsNull in local mode by @generall, @joein
    • #1389 - keep facet bool and int values distinct by @SiluPanda, @joein
    • #1387 - apply score_threshold strictly to match server semantics by @linhongyu510, @joein
    • #1379 - fix score-orientation handling for recommend/discovery/context/feedback queries in local mode by @winklemad, @joein
    • #1377 - fix TypeError when sorting mixed-type point ids in the distance matrix by @winklemad, @joein
    • #1373 - apply root filters after local fusion and push them into prefetch search by @aiedwardyi, @joein
    • #1369 - reject min_should min_count values that the server rejects by @nazsats, @joein
    • #1364 - fix shard key selector usage in update payload methods by @joein, @2sumtech
    • #1363 - give the User-Agent override warning a stacklevel so it points at the caller by @Anai-Guo
    • #1357 - fix in-place mutation of the query in cosine_similarity by @aravgarg28
    • #1356 - pin keyword index prefix=False round-trip behavior over gRPC by @2sumtech
    • #1350 - only complete an hour-only UTC offset in the datetime parse fallback by @Aryan-Pardeshi, @joein
    • #1343 - validate sparse vectors and vector dimensions with raises instead of asserts by @shashvat-singham, @joein
    • #1341 - reject negative score indices in formula variables by @shashvat-singham, @joein
    • #1339 - validate local query parameters by @adityat210, @joein
    • #1338 - raise on an unmapped StartFrom instead of returning None by @Anai-Guo
    • #1333 - fix local mode matching the wrong points on null and empty-should filters by @nazsats, @joein
    • #1332 - reject empty collection names in existence checks by @nightcityblade, @joein
    • #1308 - support FieldCondition.is_empty/is_null in local mode by @sainikhiljuluri, @joein
    • #1435 - fix mypy complaint about the geo coordinates type by @joein

    Thanks to everyone who contributed to the current release! @HaokaiDing @pentaoa @betacatsling @bijay-odyssey @2sumtech @N

  3. v1.19.02026-08-04 · 2026-08-04 14:49 UTC
    查看更新说明

    Change Log

    Features 🌊

    • #1298 - payload storage configuration in create_collection (supersedes on_disk_payload) and more by @joein
    • #1247 - warn that search_params is ignored in local mode instead of silently dropping it by @MushiSenpai, @joein

    Fixes 🧑‍🔧

    • #1260 - preserve proto3 field presence for falsy values in REST/gRPC conversion by @winklemad, @joein
    • #1312 - fix nested payload handling in local mode by @joein
    • #1293 - values_count bounds must be satisfied by a single value in local mode by @nazsats
    • #1281 - add limit > 0 rules in local mode by @joein
    • #1279 - do not drop falsy shard keys in convert_points_update_operation by @ErenAta16
    • #1278 - fix embed paths by @joein
    • #1276 - fix local mode set_payload on shared nested objects by @joein, @ErenAta16
    • #1277 - do not include local test files into the distribution by @joein, @hassanzafarr
    • #1259 - fix local mode filters cross-matching booleans and integers by @winklemad, @joein
    • #1244 - fix update vectors in local mode by @joein
    • #1224 - check_match() raises TypeError when MatchText applied to a non-string field by @aloktripathi1, @joein
    • #1181 - fix spurious async client tests failures by @charles-dyfis-net, @joein

    Deprecations ⏲️

    • #1210 - add and query methods have been removed, use FastEmbed with upsert/query_points instead by @joein
    • #1311 - max_resident_memory_percent has been deprecated by @joein
    • #1298 - search, search_batch, search_groups, recommend, recommend_batch, recommend_groups and on_disk_payload have been deprecated in favour of query_points, query_batch_points, query_points_groups and the new payload config by @joein

    Misc 🧰

    • #1216 - update third-party actions to node 24 by @estebany-qd
    • #1212 - update GitHub Actions to node 24 by @estebany-qd
    • #1207 - check the package is importable before publish by @joein
    • #1199 - add docstring for ParallelWorkerPool class by @Goodnight77

    Thanks to everyone who contributed to the current release! @nazsats @winklemad @ErenAta16 @MushiSenpai @charles-dyfis-net @aloktripathi1 @Goodnight77 @hassanzafarr @estebany-qd @joein

  4. v1.18.02026-05-11 · 2026-05-11 15:01 UTC
    查看更新说明

    Change Log

    Features 🌊

    • #1176 - bump fastembed to v0.8.0 by @joein
    • #1173 - per request custom headers for tracing by @generall
    • #1201 - create/delete named vector API after creating a collection, turboquantization and more

    Fixes 🧑‍🔧

    • #1191 - fix local mode inconsistency of values count with the server in case of iterables other than list by @joein
    • #1190 - fix local mode geo filter edge cases by @joein

    Deprecations ⏲️

    • #1174 - python-client docs has been deprecated in favour of qdrant.tech documentation by @joein

    • #1169 - do not modify date filters in local mode by @jnMetaCode

    • #1168 - run server version check in a thread to avoid blocking async client by @joein

    • #1157 - fix type hint error in grpc_uploader with older versions of protobuf by @joein

    Thanks to everyone who contributed to the current release! @jnMetaCode @Anush008 @joein

  5. v1.17.12026-03-13 · 2026-03-13 17:49 UTC
    查看更新说明

    Change Log

    Features 🌊

    • #1162 - add a way to provide custom headers in http and grpc by @Anush008 @joein
    • #1166 - do not use fastembed for bm25 inference with hosted qdrant by @joein

    Fixes 🔧

    • #1169 - do not modify date filters in local mode by @jnMetaCode
    • #1168 - run server version check in a thread to avoid blocking async client by @joein
    • #1157 - fix type hint error in grpc_uploader with older versions of protobuf by @joein

    Thanks to everyone who contributed to the current release! @jnMetaCode @Anush008 @joein

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Python Qdrant Client

    Client library and SDK for the Qdrant vector search engine.

    Library contains type definitions for all Qdrant API and allows to make both Sync and Async requests.

    Client allows calls for all Qdrant API methods directly. It also provides some additional helper methods for frequently required operations, e.g. initial collection uploading.

    See QuickStart for more details!

    Installation

    pip install qdrant-client
    

    The REST client decodes responses faster with orjson. To use it, install the optional orjson extra:

    pip install 'qdrant-client[orjson]'
    

    Features

    • Type hints for all API methods
    • Local mode - use same API without running server
    • REST and gRPC support
    • Minimal dependencies
    • Extensive Test Coverage

    Local mode

    Python client allows you to run same code in local mode without running Qdrant server.

    Simply initialize client like this:

    from qdrant_client import QdrantClient
    
    client = QdrantClient(":memory:")
    # or
    client = QdrantClient(path="path/to/db")  # Persists changes to disk
    

    Local mode is useful for development, prototyping and testing.

    • You can use it to run tests in your CI/CD pipeline.
    • Run it in Colab or Jupyter Notebook, no extra dependencies required. See an example
    • When you need to scale, simply switch to server mode.

    Connect to Qdrant server

    To connect to Qdrant server, simply specify host and port:

    from qdrant_client import QdrantClient
    
    client = QdrantClient(host="localhost", port=6333)
    # or
    client = QdrantClient(url="http://localhost:6333")
    

    You can run Qdrant server locally with docker:

    docker run -p 6333:6333 qdrant/qdrant:latest
    

    See more launch options in Qdrant repository.

    Connect to Qdrant cloud

    You can register and use Qdrant Cloud to get a free tier account with 1GB RAM.

    Once you have your cluster and API key, you can connect to it like this:

    from qdrant_client import QdrantClient
    
    qdrant_client = QdrantClient(
        url="https://xxxxxx-xxxxx-xxxxx-xxxx-xxxxxxxxx.us-east.aws.cloud.qdrant.io:6333",
        api_key="<your-api-key>",
    )
    

    Inference API

    Qdrant Client has Inference API that allows to seamlessly create embeddings and use them in Qdrant. Inference API can be used locally with FastEmbed or remotely with models available in Qdrant Cloud.

    Local Inference with FastEmbed

    pip install qdrant-client[fastembed]
    

    FastEmbed is a library for creating fast vector embeddings on CPU. It is based on ONNX Runtime and allows to run inference both on CPU and GPU.

    Qdrant Client can use FastEmbed to create embeddings and upload them to Qdrant. This allows to simplify API and make it more intuitive.

    from qdrant_client import QdrantClient, models
    
    # running qdrant in local mode suitable for experiments
    client = QdrantClient(":memory:")  # or QdrantClient(path="path/to/db") for local mode and persistent storage
    
    model_name = "sentence-transformers/all-MiniLM-L6-v2"
    payload = [
        {"document": "Qdrant has Langchain integrations", "source": "Langchain-docs", },
        {"document": "Qdrant also has Llama Index integrations", "source": "LlamaIndex-docs"},
    ]
    docs = [models.Document(text=data["document"], model=model_name) for data in payload]
    ids = [42, 2]
    
    client.create_collection(
        "demo_collection",
        vectors_config=models.VectorParams(
            size=client.get_embedding_size(model_name), distance=models.Distance.COSINE)
    )
    
    client.upload_collection(
        collection_name="demo_collection",
        vectors=docs,
        ids=ids,
        payload=payload,
    )
    
    search_result = client.query_points(
        collection_name="demo_collection",
        query=models.Document(text="This is a query document", model=model_name)
    ).points
    print(search_result)
    

    FastEmbed can also utilise GPU for faster embeddings. To enable GPU support, install

    pip install 'qdrant-client[fastembed-gpu]'
    

    In order to set GPU, extend documents from the previous example with options.

    models.Document(text="To be computed on GPU", model=model_name, options={"cuda": True})
    

    Note: fastembed-gpu and fastembed are mutually exclusive. You can only install one of them.

    If you previously installed fastembed, you might need to start from a fresh environment to install fastembed-gpu.

    Remote inference with Qdrant Cloud

    Qdrant Cloud provides a set of predefined models that can be used for inference without a need to install any additional libraries or host models locally. (Currently available only on paid plans.)

    Inference API is the same as in the local mode, but the client has to be instantiated with cloud_inference=True:

    from qdrant_client import QdrantClient
    client = QdrantClient(
        url="https://xxxxxx-xxxxx-xxxxx-xxxx-xxxxxxxxx.us-east.aws.cloud.qdrant.io:6333",
        api_key="<your-api-key>",
        cloud_inference=True,  # Enable remote inference
    )
    

    Note: remote inference requires images to be provided as base64 encoded strings or urls

    Examples

    Create a new collection

    from qdrant_client.models import Distance, VectorParams
    
    client.create_collection(
        collection_name="my_collection",
        vectors_config=VectorParams(size=100, distance=Distance.COSINE),
    )
    

    Insert vectors into a collection

    import numpy as np
    
    from qdrant_client.models import PointStruct
    
    vectors = np.random.rand(100, 100)
    # NOTE: consider splitting the data into chunks to avoid hitting the server's payload size limit
    # or use `upload_collection` or `upload_points` methods which handle this for you
    # WARNING: uploading points one-by-one is not recommended due to requests overhead
    client.upsert(
        collection_name="my_collection",
        points=[
            PointStruct(
                id=idx,
                vector=vector.tolist(),
                payload={"color": "red", "rand_number": idx % 10}
            )
            for idx, vector in enumerate(vectors)
        ]
    )
    

    Search for similar vectors

    query_vector = np.random.rand(100)
    hits = client.query_points(
        collection_name="my_collection",
        query=query_vector,
        limit=5  # Return 5 closest points
    )
    

    Search for similar vectors with filtering condition

    from qdrant_client.models import Filter, FieldCondition, Range
    
    hits = client.query_points(
        collection_name="my_collection",
        query=query_vector,
        query_filter=Filter(
            must=[  # These conditions are required for search results
                FieldCondition(
                    key='rand_number',  # Condition based on values of `rand_number` field.
                    range=Range(
                        gte=3  # Select only those results where `rand_number` >= 3
                    )
                )
            ]
        ),
        limit=5  # Return 5 closest points
    )
    

    See more examples in our Documentation!

    gRPC

    To enable (typically, much faster) collection uploading with gRPC, use the following initialization:

    from qdrant_client import QdrantClient
    
    client = QdrantClient(host="localhost", grpc_port=6334, prefer_grpc=True)
    

    Async client

    Starting from version 1.6.1, all python client methods are available in async version.

    To use it, just import AsyncQdrantClient instead of QdrantClient:

    import asyncio
    
    import numpy as np
    
    from qdrant_client import AsyncQdrantClient, models
    
    
    async def main():
        # Your async code using QdrantClient might be put here
        client = AsyncQdrantClient(url="http://localhost:6333")
    
        await client.create_collection(
            collection_name="my_collection",
            vectors_config=models.VectorParams(size=10, distance=models.Distance.COSINE),
        )
    
        await client.upsert(
            collection_name="my_collection",
            points=[
                models.PointStruct(
                    id=i,
                    vector=np.random.rand(10).tolist(),
                )
                for i in range(100)
            ],
        )
    
        res = await client.query_points(
            collection_name="my_collection",
            query=np.random.rand(10).tolist(),  # type: ignore
            limit=10,
        )
    
        print(res)
    
    asyncio.run(main())
    

    Both, gRPC and REST API are supported in async mode. More examples can be found here.

    Development

    This project uses git hooks to run code formatters.

    Set up hooks with pre-commit install before making contributions.