fastembed 与 fastembed-gpu 互斥,只能装其中一个,装过 fastembed 需换干净环境再装 GPU 版;远程推理需 Qdrant Cloud 付费计划且图片要以 base64 或 URL 提供;逐条 upsert 请求开销大,大批量应改用 upload_collection 或 upload_points
qdrant-client
qdrantApache-2.0活跃维护Qdrant 向量搜索引擎的官方 Python 客户端,方便在 Python 项目里接入向量检索,做相似度搜索和 RAG 应用。
Python client for Qdrant vector search engine
pip install qdrant-client
pip install 'qdrant-client[fastembed]'README 未说明显存要求;本地模式可在 CPU 上运行,FastEmbed 基于 ONNX Runtime 支持 CPU 与 GPU,GPU 需安装 fastembed-gpu 并在 Document 中设置 options={"cuda": True}
Qdrant 向量搜索引擎的 Python 客户端,支持本地内存模式与远程服务,方便快速接入向量检索
Qdrant 向量搜索引擎的官方 Python 客户端,方便在 Python 项目里接入向量检索,做相似度搜索和 RAG 应用。
核心能力
- 为全部 Qdrant API 提供类型提示
- 支持 REST 与 gRPC 两种传输方式
- 用 :memory: 或本地路径免服务器运行
- 提供 AsyncQdrantClient 全异步接口
- 集成 FastEmbed 在本地生成向量嵌入
容易踩的坑
- v1.20.0最新正式版2026-10-22 · 2026-10-22 11:35 UTC
Change Log
Highlights 🔦
Qdrant 1.20 🎃
BM25 is now supported through
TextQuery: setscoringon 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 themax,min, andacoshexpressions.The new
MatchSubstringcondition finds keyword values that contain a given string, using a keyword index. Payload indexes can benested, indexing every object of an array as its own entry: withnested: offers, a text index onoffers[].descriptionmatches and BM25-scores each offer separately.Performance 🐺
With pydantic v2, parsing REST responses with vectors is about 2x quicker, and about 3x with the
orjsonextra (pip install 'qdrant-client[orjson]'). On protobuf 6.30 and later, gRPC writes with payloads are up to about 3x quicker.PointStruct,PointVectors, andBatchare 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
spawninstead offorkserver, which crashed on Python 3.15. Passmethod="forkserver"toupload_pointsorupload_collectionto 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..raiseValueError(#1291). - Uploads raise
ValueErrorwhenidsorpayloadis shorter than the vectors, whenparallelis negative, or whenauth_token_provideris async.parallel=0uses all CPU cores (#1578, #1531, #1520).
Features 🍬
- #1610 - support Qdrant v1.20: BM25 text queries (
TextQuery) withscoringon text indexes,MatchSubstring,max,min, andacoshformula expressions,nestedpayload indexes,id_trackercollection config,turbo8andturbo16datatypes, and thecodetokenizer;migratekeeps thepayloadandid_trackercollection params by @joein - #1565, #1566 - skip re-validation of vectors and payloads when parsing REST responses on pydantic v2, and add an
orjsonextra 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, andBatchby @joein - #1558 - bump fastembed to 0.9.0 by @joein
- #1555 - cut main process memory of parallel uploads by @joein
- #1519 - add
with_toget_optimizationsto requestqueued,completed, andidle_segments, and requestcompletedwhencompleted_limitis set by @joein
Fixes 🚑
- #1605, #1617 - default the text index tokenizer to
wordincreate_payload_index, and convertWriteOrderingincreate_payload_indexanddelete_payload_indexover gRPC by @feiiiiii5, @astroknot-sheep, @joein - #1602 - return
Noneinstead of{}for absent collectionmetadataover gRPC by @feiiiiii5, @joein - #1590 - remove broken
request_syncfromApiClientandAsyncApiClientby @joein - #1553, #1588 - reset embedder state after a failed or abandoned
embed_models_batch, and passlocal_inference_batch_sizeto query embedding in local inference by @moneebullah25, @RAMZI0TO99, @joein - #1545, #1578 - reject
Batchcolumns of different lengths in local mode and over gRPC, andidsorpayloadshorter than vectors inupload_collectionby @fhgffy, @joein - #1572 - keep empty
pointslists in batch payload and vector updates over gRPC instead of falling back tofilterby @joein - #1490, #1563, #1570 - copy collection metadata in
migrate, validate itsbatch_sizebefore touching the destination, and drop its own retry loop, since `upload_points
- On macOS, parallel uploads and parallel local inference start workers with
- v1.19.12026-09-16 · 2026-09-16 08:24 UTC
查看更新说明
Change Log
Features 🌊
- #1419 - token-aware
MatchAnyin 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
strand non-listSequencewith_payload/with_vectorsselectors in local mode by @betacatsling, @joein - #1429 - reject 0 raised to a negative exponent in formula
PowExpressionby @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_fromwith adateobject by @joein - #1417 - fix naive datetime and exact datetime precision in
order_byby @joein, @Nimra3261 - #1416 - skip bool payload values in
order_byto match server semantics by @feiiiiii5, @joein - #1414 - skip bool group-by keys to match server
GroupIdsemantics 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_idandCollectionInfo.points_countasNoneover gRPC by @2sumtech, @joein - #1407 - honor nested json-path keys in
delete_payloadby @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_integerusage 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
IsNullin local mode by @generall, @joein - #1389 - keep facet bool and int values distinct by @SiluPanda, @joein
- #1387 - apply
score_thresholdstrictly 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
TypeErrorwhen 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_shouldmin_countvalues that the server rejects by @nazsats, @joein - #1364 - fix shard key selector usage in update payload methods by @joein, @2sumtech
- #1363 - give the
User-Agentoverride warning astacklevelso it points at the caller by @Anai-Guo - #1357 - fix in-place mutation of the query in
cosine_similarityby @aravgarg28 - #1356 - pin keyword index
prefix=Falseround-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
StartFrominstead of returningNoneby @Anai-Guo - #1333 - fix local mode matching the wrong points on null and empty-
shouldfilters by @nazsats, @joein - #1332 - reject empty collection names in existence checks by @nightcityblade, @joein
- #1308 - support
FieldCondition.is_empty/is_nullin 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
- #1419 - token-aware
- v1.19.02026-08-04 · 2026-08-04 14:49 UTC
查看更新说明
Change Log
Features 🌊
- #1298 -
payloadstorage configuration increate_collection(supersedeson_disk_payload) and more by @joein - #1247 - warn that
search_paramsis 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_countbounds must be satisfied by a single value in local mode by @nazsats - #1281 - add
limit > 0rules in local mode by @joein - #1279 - do not drop falsy shard keys in
convert_points_update_operationby @ErenAta16 - #1278 - fix embed paths by @joein
- #1276 - fix local mode
set_payloadon 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()raisesTypeErrorwhenMatchTextapplied to a non-string field by @aloktripathi1, @joein - #1181 - fix spurious async client tests failures by @charles-dyfis-net, @joein
Deprecations ⏲️
- #1210 -
addandquerymethods have been removed, use FastEmbed withupsert/query_pointsinstead by @joein - #1311 -
max_resident_memory_percenthas been deprecated by @joein - #1298 -
search,search_batch,search_groups,recommend,recommend_batch,recommend_groupsandon_disk_payloadhave been deprecated in favour ofquery_points,query_batch_points,query_points_groupsand the newpayloadconfig 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
ParallelWorkerPoolclass by @Goodnight77
Thanks to everyone who contributed to the current release! @nazsats @winklemad @ErenAta16 @MushiSenpai @charles-dyfis-net @aloktripathi1 @Goodnight77 @hassanzafarr @estebany-qd @joein
- #1298 -
- 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
- 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
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
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-gpuandfastembedare mutually exclusive. You can only install one of them.If you previously installed
fastembed, you might need to start from a fresh environment to installfastembed-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.