{"id":5286,"library":"langchain-qdrant","title":"Qdrant Integration for LangChain","description":"langchain-qdrant is an integration package connecting the LangChain framework with Qdrant, a high-performance vector similarity search engine. It enables developers to easily utilize Qdrant as a vector store for various LLM-based applications, including Retrieval-Augmented Generation (RAG). The current version is 1.1.0, and as a LangChain partner package, it follows semantic versioning, with minor releases adding new features without breaking changes and frequent patch versions for bug fixes.","status":"active","version":"1.1.0","language":"en","source_language":"en","source_url":"https://github.com/langchain-ai/langchain/tree/master/libs/partners/qdrant","tags":["langchain","qdrant","vector store","embeddings","vector database","RAG","AI","search"],"install":[{"cmd":"pip install langchain-qdrant","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core LangChain functionalities.","package":"langchain-core","optional":false},{"reason":"Data validation and settings management.","package":"pydantic","optional":false},{"reason":"Official Python client for interacting with Qdrant.","package":"qdrant-client","optional":false},{"reason":"Optional dependency for FastEmbed-based sparse embeddings.","package":"fastembed","optional":true}],"imports":[{"note":"This is the recommended and modern class for Qdrant integration.","symbol":"QdrantVectorStore","correct":"from langchain_qdrant import QdrantVectorStore"},{"note":"The `Qdrant` class within `langchain_qdrant` is now deprecated in favor of `QdrantVectorStore`. Older import paths from `langchain.vectorstores` are part of the legacy `langchain` package and should be avoided for new projects.","wrong":"from langchain.vectorstores import Qdrant","symbol":"Qdrant","correct":"from langchain_qdrant import Qdrant"},{"note":"Required to initialize the underlying Qdrant client, which is then passed to `QdrantVectorStore`.","symbol":"QdrantClient","correct":"from qdrant_client import QdrantClient"}],"quickstart":{"code":"import os\nfrom qdrant_client import QdrantClient\nfrom qdrant_client.http.models import Distance, VectorParams\nfrom langchain_qdrant import QdrantVectorStore\nfrom langchain_openai import OpenAIEmbeddings # Requires `pip install langchain-openai`\nfrom langchain_core.documents import Document\n\n# Set your OpenAI API key for embeddings (replace with your preferred embedding model)\nos.environ[\"OPENAI_API_KEY\"] = os.environ.get(\"OPENAI_API_KEY\", \"sk-...\")\n\n# 1. Initialize an in-memory Qdrant client\nclient = QdrantClient(\":memory:\")\n\n# 2. Define collection parameters (e.g., for OpenAI embeddings)\ncollection_name = \"my_langchain_collection\"\nembedding_dimension = 1536 # For text-embedding-ada-002 or text-embedding-3-small\n\nclient.create_collection(\n    collection_name=collection_name,\n    vectors_config=VectorParams(size=embedding_dimension, distance=Distance.COSINE),\n)\n\n# 3. Initialize the embedding model\nembeddings = OpenAIEmbeddings()\n\n# 4. Create a QdrantVectorStore instance\nvector_store = QdrantVectorStore(\n    client=client,\n    collection_name=collection_name,\n    embedding=embeddings,\n)\n\n# 5. Add documents to the vector store\ndocuments = [\n    Document(page_content=\"The quick brown fox jumps over the lazy dog.\", metadata={\"source\": \"sentence 1\"}),\n    Document(page_content=\"LangChain provides many integrations with vector stores.\", metadata={\"source\": \"sentence 2\"}),\n    Document(page_content=\"Qdrant is an open-source vector database.\", metadata={\"source\": \"sentence 3\"}),\n]\n\nvector_store.add_documents(documents)\n\n# 6. Perform a similarity search\nquery = \"What is Qdrant?\"\nfound_docs = vector_store.similarity_search(query, k=1)\n\nprint(f\"Query: {query}\")\nfor doc in found_docs:\n    print(f\"- Content: {doc.page_content}, Metadata: {doc.metadata}\")","lang":"python","description":"This quickstart demonstrates how to set up an in-memory Qdrant client, initialize a `QdrantVectorStore` with `OpenAIEmbeddings`, add documents, and perform a similarity search. Ensure you have `langchain-openai` installed for the embeddings. For persistent storage or remote Qdrant instances, adjust the `QdrantClient` initialization."},"warnings":[{"fix":"Migrate code to use `from langchain_qdrant import QdrantVectorStore`. Review LangChain's official documentation for migration guides related to vector store integrations.","message":"The `Qdrant` class is deprecated in favor of `QdrantVectorStore`. While still supported, new development should use `QdrantVectorStore` for modern functionalities and better API design.","severity":"deprecated","affected_versions":"All versions since the introduction of `QdrantVectorStore` (around v0.1.x of `langchain-qdrant`)."},{"fix":"Ensure your Qdrant server instance is running version 1.10.0 or newer if you plan to use advanced retrieval modes (e.g., hybrid search).","message":"When using `QdrantVectorStore` with Qdrant's new Query API (for features like sparse or hybrid retrieval), Qdrant server version 1.10.0 or above is required. Older Qdrant server versions may not support all features, leading to unexpected behavior or errors.","severity":"gotcha","affected_versions":"All `langchain-qdrant` versions leveraging new Qdrant Query API features."},{"fix":"To improve performance, consider batching documents during the embedding process (e.g., batches of 50-100). For Qdrant, tweak HNSW parameters (e.g., `m=16`, `ef_construct=200`) during collection creation for faster writes. Utilize Qdrant's async client for bulk operations, and optimize Docker memory settings if running locally.","message":"Performance bottlenecks can occur when dealing with large document collections, primarily during the embedding process and initial data loading into Qdrant. Default settings for Qdrant collections might not be optimized for bulk inserts.","severity":"gotcha","affected_versions":"All versions."},{"fix":"When updating, ensure you explicitly provide the original `id` for the documents you wish to modify. For example: `vector_store.add_documents([my_updated_doc], ids=[original_id])`.","message":"Updating existing documents in a Qdrant collection via `add_documents` or `add_texts` requires passing the same `id` as the original document. Otherwise, new points will be created instead of overwriting existing ones, leading to duplicate entries or unexpected search results.","severity":"gotcha","affected_versions":"All versions."},{"fix":"Always check the compatibility of `langchain-qdrant` with your specific `langchain-core` and other `langchain` ecosystem package versions. Refer to the main LangChain migration guides for updates on core framework changes, especially if migrating from pre-1.0 versions.","message":"While `langchain-qdrant` itself adheres to semantic versioning, the broader LangChain ecosystem (especially the `langchain` and `langchain-community` packages) has undergone significant API changes, notably with the transition to LangChain Expression Language (LCEL) and a more modular structure around LangChain v1.0. This can lead to incompatibility if other LangChain components are not aligned.","severity":"breaking","affected_versions":"Potentially all `langchain-qdrant` versions when used with older or unaligned `langchain` ecosystem packages."}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}