{"id":28493410,"url":"https://github.com/qdrant/qdrant-client","last_synced_at":"2025-07-08T11:31:16.812Z","repository":{"id":37795213,"uuid":"337259586","full_name":"qdrant/qdrant-client","owner":"qdrant","description":"Python client for Qdrant vector search engine","archived":false,"fork":false,"pushed_at":"2025-07-04T10:48:41.000Z","size":5290,"stargazers_count":1017,"open_issues_count":111,"forks_count":152,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-07-04T11:44:09.446Z","etag":null,"topics":["qdrant","vector-database","vector-search","vector-search-engine"],"latest_commit_sha":null,"homepage":"https://qdrant.tech","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qdrant.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-02-09T01:33:20.000Z","updated_at":"2025-07-04T10:29:52.000Z","dependencies_parsed_at":"2022-06-23T17:09:31.835Z","dependency_job_id":"a1dc89c3-e0fe-430e-848e-c5464877add0","html_url":"https://github.com/qdrant/qdrant-client","commit_stats":null,"previous_names":["qdrant/qdrant_client"],"tags_count":101,"template":false,"template_full_name":null,"purl":"pkg:github/qdrant/qdrant-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qdrant%2Fqdrant-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qdrant%2Fqdrant-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qdrant%2Fqdrant-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qdrant%2Fqdrant-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qdrant","download_url":"https://codeload.github.com/qdrant/qdrant-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qdrant%2Fqdrant-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264259677,"owners_count":23580858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["qdrant","vector-database","vector-search","vector-search-engine"],"created_at":"2025-06-08T09:08:42.728Z","updated_at":"2025-07-08T11:31:16.807Z","avatar_url":"https://github.com/qdrant.png","language":"Python","funding_links":[],"categories":["*Ops for AI"],"sub_categories":["Model Serving \u0026 Inference"],"readme":"\n\n\u003cp align=\"center\"\u003e\n  \u003cimg height=\"100\" src=\"https://github.com/qdrant/qdrant/raw/master/docs/logo.svg\" alt=\"Qdrant\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cb\u003ePython Client library for the \u003ca href=\"https://github.com/qdrant/qdrant\"\u003eQdrant\u003c/a\u003e vector search engine.\u003c/b\u003e\n\u003c/p\u003e\n\n\n\u003cp align=center\u003e\n    \u003ca href=\"https://pypi.org/project/qdrant-client/\"\u003e\u003cimg src=\"https://badge.fury.io/py/qdrant-client.svg\" alt=\"PyPI version\" height=\"18\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://api.qdrant.tech/\"\u003e\u003cimg src=\"https://img.shields.io/badge/Docs-OpenAPI%203.0-success\" alt=\"OpenAPI Docs\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/qdrant/qdrant-client/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-Apache%202.0-success\" alt=\"Apache 2.0 License\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://qdrant.to/discord\"\u003e\u003cimg src=\"https://img.shields.io/badge/Discord-Qdrant-5865F2.svg?logo=discord\" alt=\"Discord\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://qdrant.to/roadmap\"\u003e\u003cimg src=\"https://img.shields.io/badge/Roadmap-2025-bc1439.svg\" alt=\"Roadmap 2025\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# Python Qdrant Client\n\nClient library and SDK for the [Qdrant](https://github.com/qdrant/qdrant) vector search engine.\n\nLibrary contains type definitions for all Qdrant API and allows to make both Sync and Async requests.\n\nClient allows calls for all [Qdrant API methods](https://api.qdrant.tech/) directly.\nIt also provides some additional helper methods for frequently required operations, e.g. initial collection uploading.\n\nSee [QuickStart](https://qdrant.tech/documentation/quick-start/#create-collection) for more details!\n\n## Installation\n\n```\npip install qdrant-client\n```\n\n## Features\n\n- Type hints for all API methods\n- Local mode - use same API without running server\n- REST and gRPC support\n- Minimal dependencies\n- Extensive Test Coverage\n\n## Local mode\n\n\u003cp align=\"center\"\u003e\n  \u003c!--- https://github.com/qdrant/qdrant-client/raw/master --\u003e\n  \u003cimg max-height=\"180\" src=\"https://github.com/qdrant/qdrant-client/raw/master/docs/images/try-develop-deploy.png\" alt=\"Qdrant\"\u003e\n\u003c/p\u003e\n\nPython client allows you to run same code in local mode without running Qdrant server.\n\nSimply initialize client like this:\n\n```python\nfrom qdrant_client import QdrantClient\n\nclient = QdrantClient(\":memory:\")\n# or\nclient = QdrantClient(path=\"path/to/db\")  # Persists changes to disk\n```\n\nLocal mode is useful for development, prototyping and testing.\n\n- You can use it to run tests in your CI/CD pipeline.\n- Run it in Colab or Jupyter Notebook, no extra dependencies required. See an [example](https://colab.research.google.com/drive/1Bz8RSVHwnNDaNtDwotfPj0w7AYzsdXZ-?usp=sharing)\n- When you need to scale, simply switch to server mode.\n\n## Fast Embeddings + Simpler API\n\n```\npip install qdrant-client[fastembed]\n```\n\nFastEmbed 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.\n\nQdrant Client can use FastEmbed to create embeddings and upload them to Qdrant. This allows to simplify API and make it more intuitive.\n\n```python\nfrom qdrant_client import QdrantClient, models\n\n# running qdrant in local mode suitable for experiments\nclient = QdrantClient(\":memory:\")  # or QdrantClient(path=\"path/to/db\") for local mode and persistent storage\n\nmodel_name = \"sentence-transformers/all-MiniLM-L6-v2\"\npayload = [\n    {\"document\": \"Qdrant has Langchain integrations\", \"source\": \"Langchain-docs\", },\n    {\"document\": \"Qdrant also has Llama Index integrations\", \"source\": \"LlamaIndex-docs\"},\n]\ndocs = [models.Document(text=data[\"document\"], model=model_name) for data in payload]\nids = [42, 2]\n\nclient.create_collection(\n    \"demo_collection\",\n    vectors_config=models.VectorParams(\n        size=client.get_embedding_size(model_name), distance=models.Distance.COSINE)\n)\n\nclient.upload_collection(\n    collection_name=\"demo_collection\",\n    vectors=docs,\n    ids=ids,\n    payload=payload,\n)\n\nsearch_result = client.query_points(\n    collection_name=\"demo_collection\",\n    query=models.Document(text=\"This is a query document\", model=model_name)\n).points\nprint(search_result)\n```\n\nFastEmbed can also utilise GPU for faster embeddings. To enable GPU support, install\n\n```bash\npip install 'qdrant-client[fastembed-gpu]'\n```\n\nIn order to set GPU, extend documents from the previous example with `options`.\n```python\nmodels.Document(text=\"To be computed on GPU\", model=model_name, options={\"cuda\": True})\n```\n\n\u003e Note: `fastembed-gpu` and `fastembed` are mutually exclusive. You can only install one of them.\n\u003e\n\u003e If you previously installed `fastembed`, you might need to start from a fresh environment to install `fastembed-gpu`.\n\n## Connect to Qdrant server\n\nTo connect to Qdrant server, simply specify host and port:\n\n```python\nfrom qdrant_client import QdrantClient\n\nclient = QdrantClient(host=\"localhost\", port=6333)\n# or\nclient = QdrantClient(url=\"http://localhost:6333\")\n```\n\nYou can run Qdrant server locally with docker:\n\n```bash\ndocker run -p 6333:6333 qdrant/qdrant:latest\n```\n\nSee more launch options in [Qdrant repository](https://github.com/qdrant/qdrant#usage).\n\n\n## Connect to Qdrant cloud\n\nYou can register and use [Qdrant Cloud](https://cloud.qdrant.io/) to get a free tier account with 1GB RAM.\n\nOnce you have your cluster and API key, you can connect to it like this:\n\n```python\nfrom qdrant_client import QdrantClient\n\nqdrant_client = QdrantClient(\n    url=\"https://xxxxxx-xxxxx-xxxxx-xxxx-xxxxxxxxx.us-east.aws.cloud.qdrant.io:6333\",\n    api_key=\"\u003cyour-api-key\u003e\",\n)\n```\n\n## Examples\n\n\nCreate a new collection\n```python\nfrom qdrant_client.models import Distance, VectorParams\n\nclient.create_collection(\n    collection_name=\"my_collection\",\n    vectors_config=VectorParams(size=100, distance=Distance.COSINE),\n)\n```\n\nInsert vectors into a collection\n\n```python\nimport numpy as np\n\nfrom qdrant_client.models import PointStruct\n\nvectors = np.random.rand(100, 100)\n# NOTE: consider splitting the data into chunks to avoid hitting the server's payload size limit\n# or use `upload_collection` or `upload_points` methods which handle this for you\n# WARNING: uploading points one-by-one is not recommended due to requests overhead\nclient.upsert(\n    collection_name=\"my_collection\",\n    points=[\n        PointStruct(\n            id=idx,\n            vector=vector.tolist(),\n            payload={\"color\": \"red\", \"rand_number\": idx % 10}\n        )\n        for idx, vector in enumerate(vectors)\n    ]\n)\n```\n\nSearch for similar vectors\n\n```python\nquery_vector = np.random.rand(100)\nhits = client.query_points(\n    collection_name=\"my_collection\",\n    query=query_vector,\n    limit=5  # Return 5 closest points\n)\n```\n\nSearch for similar vectors with filtering condition\n\n```python\nfrom qdrant_client.models import Filter, FieldCondition, Range\n\nhits = client.query_points(\n    collection_name=\"my_collection\",\n    query=query_vector,\n    query_filter=Filter(\n        must=[  # These conditions are required for search results\n            FieldCondition(\n                key='rand_number',  # Condition based on values of `rand_number` field.\n                range=Range(\n                    gte=3  # Select only those results where `rand_number` \u003e= 3\n                )\n            )\n        ]\n    ),\n    limit=5  # Return 5 closest points\n)\n```\n\nSee more examples in our [Documentation](https://qdrant.tech/documentation/)!\n\n### gRPC\n\nTo enable (typically, much faster) collection uploading with gRPC, use the following initialization:\n\n```python\nfrom qdrant_client import QdrantClient\n\nclient = QdrantClient(host=\"localhost\", grpc_port=6334, prefer_grpc=True)\n```\n\n\n## Async client\n\nStarting from version 1.6.1, all python client methods are available in async version.\n\nTo use it, just import `AsyncQdrantClient` instead of `QdrantClient`:\n\n```python\nimport asyncio\n\nimport numpy as np\n\nfrom qdrant_client import AsyncQdrantClient, models\n\n\nasync def main():\n    # Your async code using QdrantClient might be put here\n    client = AsyncQdrantClient(url=\"http://localhost:6333\")\n\n    await client.create_collection(\n        collection_name=\"my_collection\",\n        vectors_config=models.VectorParams(size=10, distance=models.Distance.COSINE),\n    )\n\n    await client.upsert(\n        collection_name=\"my_collection\",\n        points=[\n            models.PointStruct(\n                id=i,\n                vector=np.random.rand(10).tolist(),\n            )\n            for i in range(100)\n        ],\n    )\n\n    res = await client.query_points(\n        collection_name=\"my_collection\",\n        query=np.random.rand(10).tolist(),  # type: ignore\n        limit=10,\n    )\n\n    print(res)\n\nasyncio.run(main())\n```\n\nBoth, gRPC and REST API are supported in async mode.\nMore examples can be found [here](./tests/test_async_qdrant_client.py).\n\n### Development\n\nThis project uses git hooks to run code formatters.\n\nSet up hooks with `pre-commit install` before making contributions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqdrant%2Fqdrant-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqdrant%2Fqdrant-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqdrant%2Fqdrant-client/lists"}