From 155e3740bce2743660d6c4f871bc288de0a1f56c Mon Sep 17 00:00:00 2001 From: Yasien Dwieb Date: Mon, 11 Aug 2025 23:31:24 +0300 Subject: [PATCH] fix(docs): handle collection not found error on RAG tutorial when qdrant is selected as vectorStore (#32099) In [Rag Part 1 Tutorial](https://python.langchain.com/docs/tutorials/rag/), when QDrant vector store is selected, the sample code does not work It fails with error `ValueError: Collection test not found` So, this fix is creating that collection and ensuring its dimension size is matching the selection the embedding size of the selected LLM Model --------- Co-authored-by: Mason Daugherty Co-authored-by: Mason Daugherty Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- docs/src/theme/VectorStoreTabs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/theme/VectorStoreTabs.js b/docs/src/theme/VectorStoreTabs.js index 17f0bd75652..f796d4a96b8 100644 --- a/docs/src/theme/VectorStoreTabs.js +++ b/docs/src/theme/VectorStoreTabs.js @@ -77,7 +77,7 @@ export default function VectorStoreTabs(props) { { value: "Qdrant", label: "Qdrant", - text: `from langchain_qdrant import QdrantVectorStore\nfrom qdrant_client import QdrantClient\n${useFakeEmbeddings ? fakeEmbeddingsString : ""}\nclient = QdrantClient(":memory:")\n${vectorStoreVarName} = QdrantVectorStore(\n client=client,\n collection_name="test",\n embedding=embeddings,\n)`, + text: `from qdrant_client.models import Distance, VectorParams\nfrom langchain_qdrant import QdrantVectorStore\nfrom qdrant_client import QdrantClient\n${useFakeEmbeddings ? fakeEmbeddingsString : ""}\nclient = QdrantClient(":memory:")\n\nvector_size = len(embeddings.embed_query("sample text"))\n\nif not client.collection_exists("test"):\n client.create_collection(\n collection_name="test",\n vectors_config=VectorParams(size=vector_size, distance=Distance.COSINE)\n )\n${vectorStoreVarName} = QdrantVectorStore(\n client=client,\n collection_name="test",\n embedding=embeddings,\n)`, packageName: "langchain-qdrant", default: false, },