Qdrant Class — langchain Architecture
Architecture documentation for the Qdrant class in vectorstores.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD bf62db79_4217_463c_798f_6f8528ed0d6e["Qdrant"] 9d2a2799_754f_4de7_e4e6_081d8ea620e0["VectorStore"] bf62db79_4217_463c_798f_6f8528ed0d6e -->|extends| 9d2a2799_754f_4de7_e4e6_081d8ea620e0 c58e6864_9429_b081_883b_39ba15df0485["Embeddings"] bf62db79_4217_463c_798f_6f8528ed0d6e -->|extends| c58e6864_9429_b081_883b_39ba15df0485 cf5060bb_3c9f_3c4e_d3a7_03999abcf544["vectorstores.py"] bf62db79_4217_463c_798f_6f8528ed0d6e -->|defined in| cf5060bb_3c9f_3c4e_d3a7_03999abcf544 95ea2370_2ea2_e4e5_a746_9ad22d16e48f["__init__()"] bf62db79_4217_463c_798f_6f8528ed0d6e -->|method| 95ea2370_2ea2_e4e5_a746_9ad22d16e48f 764dd93f_b65e_f753_9b79_dd9b5db4e0c0["embeddings()"] bf62db79_4217_463c_798f_6f8528ed0d6e -->|method| 764dd93f_b65e_f753_9b79_dd9b5db4e0c0 4da39fb6_0b3c_26e3_93cd_edfd42d30436["add_texts()"] bf62db79_4217_463c_798f_6f8528ed0d6e -->|method| 4da39fb6_0b3c_26e3_93cd_edfd42d30436 675dc134_0c09_bf23_f892_4a4af82a4549["aadd_texts()"] bf62db79_4217_463c_798f_6f8528ed0d6e -->|method| 675dc134_0c09_bf23_f892_4a4af82a4549 c00c442a_f0df_4290_b7d7_342034350936["similarity_search()"] bf62db79_4217_463c_798f_6f8528ed0d6e -->|method| c00c442a_f0df_4290_b7d7_342034350936 68ab7e0f_3f6a_c491_3d0a_a689ac0ec38a["asimilarity_search()"] bf62db79_4217_463c_798f_6f8528ed0d6e -->|method| 68ab7e0f_3f6a_c491_3d0a_a689ac0ec38a 39b56a94_734a_4e6b_c1e1_da8cc30168e8["similarity_search_with_score()"] bf62db79_4217_463c_798f_6f8528ed0d6e -->|method| 39b56a94_734a_4e6b_c1e1_da8cc30168e8 54148685_b625_1439_e4cf_0553492b20f9["asimilarity_search_with_score()"] bf62db79_4217_463c_798f_6f8528ed0d6e -->|method| 54148685_b625_1439_e4cf_0553492b20f9 6a3478b4_fa50_7588_03e1_77e7f3ca09fc["similarity_search_by_vector()"] bf62db79_4217_463c_798f_6f8528ed0d6e -->|method| 6a3478b4_fa50_7588_03e1_77e7f3ca09fc 503a0ffb_6858_79c6_16e8_e6b733ac6e1d["asimilarity_search_by_vector()"] bf62db79_4217_463c_798f_6f8528ed0d6e -->|method| 503a0ffb_6858_79c6_16e8_e6b733ac6e1d 6c8c9cf1_343a_b7b2_1ac5_f0f159c55037["similarity_search_with_score_by_vector()"] bf62db79_4217_463c_798f_6f8528ed0d6e -->|method| 6c8c9cf1_343a_b7b2_1ac5_f0f159c55037
Relationship Graph
Source Code
libs/partners/qdrant/langchain_qdrant/vectorstores.py lines 60–2332
class Qdrant(VectorStore):
"""`Qdrant` vector store.
```python
from qdrant_client import QdrantClient
from langchain_qdrant import Qdrant
client = QdrantClient()
collection_name = "MyCollection"
qdrant = Qdrant(client, collection_name, embedding_function)
```
"""
CONTENT_KEY: str = "page_content"
METADATA_KEY: str = "metadata"
VECTOR_NAME: str | None = None
def __init__(
self,
client: Any,
collection_name: str,
embeddings: Embeddings | None = None,
content_payload_key: str = CONTENT_KEY,
metadata_payload_key: str = METADATA_KEY,
distance_strategy: str = "COSINE",
vector_name: str | None = VECTOR_NAME,
async_client: Any | None = None,
embedding_function: Callable | None = None, # deprecated
) -> None:
"""Initialize with necessary components."""
if not isinstance(client, QdrantClient):
msg = (
f"client should be an instance of qdrant_client.QdrantClient, "
f"got {type(client)}"
)
raise TypeError(msg)
if async_client is not None and not isinstance(async_client, AsyncQdrantClient):
msg = (
f"async_client should be an instance of qdrant_client.AsyncQdrantClient"
f"got {type(async_client)}"
)
raise ValueError(msg)
if embeddings is None and embedding_function is None:
msg = "`embeddings` value can't be None. Pass `embeddings` instance."
raise ValueError(msg)
if embeddings is not None and embedding_function is not None:
msg = (
"Both `embeddings` and `embedding_function` are passed. "
"Use `embeddings` only."
)
raise ValueError(msg)
self._embeddings = embeddings
self._embeddings_function = embedding_function
self.client: QdrantClient = client
self.async_client: AsyncQdrantClient | None = async_client
self.collection_name = collection_name
self.content_payload_key = content_payload_key or self.CONTENT_KEY
self.metadata_payload_key = metadata_payload_key or self.METADATA_KEY
self.vector_name = vector_name or self.VECTOR_NAME
if embedding_function is not None:
warnings.warn(
"Using `embedding_function` is deprecated. "
"Pass `Embeddings` instance to `embeddings` instead.",
stacklevel=2,
)
if not isinstance(embeddings, Embeddings):
warnings.warn(
"`embeddings` should be an instance of `Embeddings`."
"Using `embeddings` as `embedding_function` which is deprecated",
stacklevel=2,
)
self._embeddings_function = embeddings
self._embeddings = None
self.distance_strategy = distance_strategy.upper()
Extends
Source
Frequently Asked Questions
What is the Qdrant class?
Qdrant is a class in the langchain codebase, defined in libs/partners/qdrant/langchain_qdrant/vectorstores.py.
Where is Qdrant defined?
Qdrant is defined in libs/partners/qdrant/langchain_qdrant/vectorstores.py at line 60.
What does Qdrant extend?
Qdrant extends VectorStore, Embeddings.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free